Skip to content

Commit

Permalink
use Mul<f32> to double the value of Vec3 (bevyengine#6607)
Browse files Browse the repository at this point in the history
improve the example code
  • Loading branch information
rick68 authored and taiyoungjang committed Dec 15, 2022
1 parent 42e5d50 commit 5a4ec0f
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 5a4ec0f

Please sign in to comment.