Skip to content

Commit eaa35cf

Browse files
committed
use Mul<f32> to double the value of Vec3 (#6607)
improve the example code
1 parent 6993f3c commit eaa35cf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

examples/ecs/iter_combinations.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ fn integrate(mut query: Query<(&mut Acceleration, &mut Transform, &mut LastPos)>
175175
// verlet integration
176176
// x(t+dt) = 2x(t) - x(t-dt) + a(t)dt^2 + O(dt^4)
177177

178-
let new_pos =
179-
transform.translation + transform.translation - last_pos.0 + acceleration.0 * dt_sq;
178+
let new_pos = transform.translation * 2.0 - last_pos.0 + acceleration.0 * dt_sq;
180179
acceleration.0 = Vec3::ZERO;
181180
last_pos.0 = transform.translation;
182181
transform.translation = new_pos;

0 commit comments

Comments
 (0)