diff options
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 |
