Skip to content

Commit 0458f3c

Browse files
committed
oups
1 parent 55c8cc9 commit 0458f3c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ import('./pkg')
1818
function worldUniversal() {
1919
world = wasm.World.new();
2020
world.add_object(0., 0., 0., 0., 50., 100000000000000000., 0.5, false);
21-
world.add_object(0., -300., 600., 0., 20., 10000000., 0.5, false);
22-
world.add_object(0., 200., -700., 0., 15., 5000000., 0.5, false);
21+
world.add_object(0., -300., 120., 0., 20., 10000000., 0.5, false);
22+
world.add_object(0., 200., -170., 0., 15., 5000000., 0.5, false);
2323
world.set_gravity_y(0.);
24-
world.set_meter_size(0.001);
24+
world.set_meter_size(1);
2525
}
2626

2727
function worldMultiCollision() {

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ impl World {
126126
let G = 6.674e-11;
127127
let F = ((G * (obj.mass * obj_.mass)) / (d * d));
128128
let a = delta_y.atan2(delta_x);
129-
obj.velocity_x += F.obj.mass * elapsed_time * a.cos();
130-
obj.velocity_y += F.obj.mass * elapsed_time * a.sin();
131-
obj_.velocity_x -= F.obj_.mass * elapsed_time * a.cos();
132-
obj_.velocity_y -= F.obj_.mass * elapsed_time * a.sin();
129+
obj.velocity_x += F/obj.mass * elapsed_time * a.cos();
130+
obj.velocity_y += F/obj.mass * elapsed_time * a.sin();
131+
obj_.velocity_x -= F/obj_.mass * elapsed_time * a.cos();
132+
obj_.velocity_y -= F/obj_.mass * elapsed_time * a.sin();
133133
}
134134

135135
// collisions

0 commit comments

Comments
 (0)