-
I may be doing something wrong, but it looks to me like the Acceleration component keeps being applied while PhysicsTime is paused. Here is a quick example program: use bevy::prelude::*;
use heron::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(PhysicsPlugin::default())
.add_startup_system(init)
.add_system(update)
.run();
}
fn init(
mut commands: Commands,
) {
commands
.spawn_bundle(OrthographicCameraBundle::new_2d());
commands
.spawn_bundle(SpriteBundle {
sprite: Sprite {
color: Color::RED,
custom_size: Some(Vec2::new(10.,10.)),
..Default::default()
},
..Default::default()
})
.insert(RigidBody::Dynamic)
.insert(CollisionShape::Sphere { radius: 10.0 })
.insert(PhysicMaterial {
density: 0.2,
friction: 0.0,
..Default::default()
})
.insert(Velocity::default())
.insert(Acceleration::from_linear(Vec3::new(10.0,0.0,0.0)));
}
fn update(
keys: Res<Input<KeyCode>>,
mut physics_time: ResMut<PhysicsTime>,
) {
if keys.just_pressed(KeyCode::P) {
physics_time.pause();
} else if keys.just_pressed(KeyCode::R) {
physics_time.resume();
}
} In this program, the sprite has an acceleration applied to it, moving it to the right. Unless I'm mistaken, I think this might not be the expected behavior. Should I report an issue out of this ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Looks like a bug to me. You can create the issue. |
Beta Was this translation helpful? Give feedback.
Looks like a bug to me. You can create the issue.