We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the app is defocused, moving objects accelerate to insane speeds.
Video https://cdn.discordapp.com/attachments/1239146961131536404/1239146963287412757/Video_2024-05-12_12-22.mp4?ex=6641dd0a&is=66408b8a&hm=82adeb09305799e09eb994e08043e06eb715b6cec33aaafcebc565c9243137ea&
#[derive(Event)] pub struct MovementEntity(pub Entity, pub Vec3, pub f32); // 0 - Entity, 1 - Diraction, 2 - Speed fn handle_move( mut query: Query<( &mut EntityBase, &mut Transform, &mut Velocity )>, mut event: EventReader<MovementEntity>, mut dir_event: EventWriter<DirectionChangeEvent>, ) { if event.is_empty() { return; } for event in event.read() { if let Ok((mut entity_base, mut transform, mut velocity)) = query.get_mut(event.0) { if event.1 != Vec3::ZERO { let move_var = event.1 / event.1.length(); velocity.linvel = move_var.truncate() * event.2; entity_base.position = Position(transform.translation); } else { transform.translation = entity_base.position.0 } } } } fn inertia_attenuation( mut query: Query<&mut Velocity, With<EntityBase>>, time: Res<Time> ) { if query.is_empty() { return; } let damping_coefficient = 100.; for mut vel in query.iter_mut() { if vel.linvel != Vec2::ZERO { vel.linvel.x *= damping_coefficient * time.delta_seconds(); vel.linvel.y *= damping_coefficient * time.delta_seconds(); } } }
The text was updated successfully, but these errors were encountered:
My mistake, dumping coefficient was set incorrectly and delta time is not needed there
Sorry, something went wrong.
No branches or pull requests
When the app is defocused, moving objects accelerate to insane speeds.
Video
https://cdn.discordapp.com/attachments/1239146961131536404/1239146963287412757/Video_2024-05-12_12-22.mp4?ex=6641dd0a&is=66408b8a&hm=82adeb09305799e09eb994e08043e06eb715b6cec33aaafcebc565c9243137ea&
The text was updated successfully, but these errors were encountered: