Skip to content

Commit

Permalink
use Mul<f32> to double the value of Vec3 (#6607)
Browse files Browse the repository at this point in the history
improve the example code
  • Loading branch information
rick68 committed Nov 14, 2022
1 parent 6993f3c commit eaa35cf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions examples/ecs/iter_combinations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eaa35cf

Please sign in to comment.