aboutsummaryrefslogtreecommitdiff
path: root/src/phys/world.odin
diff options
context:
space:
mode:
authorXander Swan <[hidden email]>2025-12-23 21:35:30 -0500
committerXander Swan <[hidden email]>2025-12-23 21:35:30 -0500
commit1754937f0721f304f742575e9a27fc7ba10d8374 (patch)
treedf439bfd9733d9553ce867df6f69e5348161801c /src/phys/world.odin
parent673c84b1e56f65bcda448b2304e98ff4831100fd (diff)
Add temp tile collisions
Diffstat (limited to 'src/phys/world.odin')
-rw-r--r--src/phys/world.odin12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/phys/world.odin b/src/phys/world.odin
index 0f03de7..8470872 100644
--- a/src/phys/world.odin
+++ b/src/phys/world.odin
@@ -195,15 +195,21 @@ update_body :: proc(h: Body_Handle) {
b.vel.y = 0
}
+ set_body_position(h, res_pos)
+}
+
+set_body_position :: proc(h: Body_Handle, new_pos: Vec2) {
+ b := get_body(h)
+
prev_bin := hash_bin(world_to_bin(b.pos + b.rect.start))
- res_bin := hash_bin(world_to_bin(res_pos + b.rect.start))
+ res_bin := hash_bin(world_to_bin(new_pos + b.rect.start))
if prev_bin != res_bin {
remove_from_bins(b^)
- b.pos = res_pos
+ b.pos = new_pos
add_to_bins(b^)
} else {
- b.pos = res_pos
+ b.pos = new_pos
}
}