Originally posted by **cark** April 21, 2022
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:
```Rust
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>,
mut physics_time: ResMut,
) {
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.
Pressing the P key pauses the physics, and the sprite indeed stops moving.
Pressing the R, resumes the physics simulation. But we notice that (depending on the time we've been pausing) the Velocity is greatly increased. In this example, pausing for 15 seconds makes it pretty obvious.
Unless I'm mistaken, I think this might not be the expected behavior.
Should I report an issue out of this ?
Discussed in https://github.com/jcornaz/heron/discussions/250
Here is a repository with the actual code: https://github.com/cark/HeronAcceleratingPause Please note that the keyboard input used in the example is the space bar instead of P and R.