aboutsummaryrefslogtreecommitdiff
path: root/src/phys/world.odin
diff options
context:
space:
mode:
authoriamcheeseman <[hidden email]>2026-01-17 18:26:55 -0500
committeriamcheeseman <[hidden email]>2026-01-17 18:26:55 -0500
commita48cdcab8a483ac9c8524cc7fd1613f0d90cf4d4 (patch)
tree9479cb7aaa5ca32de6d3e53181b0700cef91f4c2 /src/phys/world.odin
parent28e1c7913b6a10502596b4038c554154414d2fad (diff)
this is also better
Diffstat (limited to 'src/phys/world.odin')
-rw-r--r--src/phys/world.odin11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/phys/world.odin b/src/phys/world.odin
index 3dbd052..0f1451c 100644
--- a/src/phys/world.odin
+++ b/src/phys/world.odin
@@ -84,13 +84,10 @@ _remove_from_bins :: proc(b: Body) {
assert(len(bin) > 0)
assert(bin[b.bin_idx] == b.handle)
- last := pop(bin)
- if last != b.handle {
- // log.debug(last, b.handle)
- bin[b.bin_idx] = last
-
- last_body := _get_body(last)
- last_body.bin_idx = b.bin_idx
+ unordered_remove(bin, b.bin_idx)
+ if int(b.bin_idx) != len(bin) {
+ swapped_body := _get_body(bin[b.bin_idx])
+ swapped_body.bin_idx = b.bin_idx
}
}