use Mul<f32>
to double the value of Vec3
(#6607)
improve the example code
This commit is contained in:
parent
6993f3cfe3
commit
eaa35cf99f
@ -175,8 +175,7 @@ fn integrate(mut query: Query<(&mut Acceleration, &mut Transform, &mut LastPos)>
|
||||
// verlet integration
|
||||
// x(t+dt) = 2x(t) - x(t-dt) + a(t)dt^2 + O(dt^4)
|
||||
|
||||
let new_pos =
|
||||
transform.translation + transform.translation - last_pos.0 + acceleration.0 * dt_sq;
|
||||
let new_pos = transform.translation * 2.0 - last_pos.0 + acceleration.0 * dt_sq;
|
||||
acceleration.0 = Vec3::ZERO;
|
||||
last_pos.0 = transform.translation;
|
||||
transform.translation = new_pos;
|
||||
|
Loading…
Reference in New Issue
Block a user