We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8783831 commit 55c8cc9Copy full SHA for 55c8cc9
1 file changed
src/lib.rs
@@ -126,10 +126,10 @@ impl World {
126
let G = 6.674e-11;
127
let F = ((G * (obj.mass * obj_.mass)) / (d * d));
128
let a = delta_y.atan2(delta_x);
129
- obj.velocity_x += F * elapsed_time * a.cos();
130
- obj.velocity_y += F * elapsed_time * a.sin();
131
- obj_.velocity_x -= F * elapsed_time * a.cos();
132
- obj_.velocity_y -= F * elapsed_time * a.sin();
+ obj.velocity_x += F.obj.mass * elapsed_time * a.cos();
+ obj.velocity_y += F.obj.mass * elapsed_time * a.sin();
+ obj_.velocity_x -= F.obj_.mass * elapsed_time * a.cos();
+ obj_.velocity_y -= F.obj_.mass * elapsed_time * a.sin();
133
}
134
135
// collisions
0 commit comments