diff options
| author | iamcheeseman <[hidden email]> | 2026-01-14 19:21:33 -0500 |
|---|---|---|
| committer | iamcheeseman <[hidden email]> | 2026-01-14 19:21:33 -0500 |
| commit | d6f276be6bc1214c88cfc5346ceb7a5bea610638 (patch) | |
| tree | 9b1f4d1aa4a02f2855c14dea2bf440f58343cc0e /src/phys/world.odin | |
| parent | 1b8553bf96017795dcf081b78371c3b2a8d5ecc5 (diff) | |
i HATE physics bugs (i haven't fixed them yet)
Diffstat (limited to 'src/phys/world.odin')
| -rw-r--r-- | src/phys/world.odin | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/phys/world.odin b/src/phys/world.odin index 5bbfcbd..7a56990 100644 --- a/src/phys/world.odin +++ b/src/phys/world.odin @@ -33,9 +33,9 @@ _hash_bin :: proc(x: i32, y: i32) -> u32 { @(private = "file") _world_to_bin :: proc(point: Vec2) -> (i32, i32) { - return i32( - math.floor(point.x / BIN_SIZE), - ), i32(math.floor(point.y / BIN_SIZE)) + return \ + i32(math.floor(point.x / BIN_SIZE)), + i32(math.floor(point.y / BIN_SIZE)) } @(private = "file") @@ -85,8 +85,9 @@ _remove_from_bins :: proc(b: Body) { last := pop(bin) if last != b.handle { // log.debug(last, b.handle) - last_body := get_body(last) bin[b.bin_idx] = last + + last_body := get_body(last) last_body.bin_idx = b.bin_idx } } @@ -192,6 +193,10 @@ update_body :: proc(h: Body_Handle) { c := get_body(c_h) + if b.mask & c.layers == {} { + continue + } + c_rect := c.rect c_rect.start += c.pos |
