Skip to content

Commit

Permalink
Check if body is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Feodrippe committed Jun 23, 2024
1 parent 5378cdc commit a716eb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Master

## v0.1.65
## v0.1.66

- Allow dynamic flecs queries
- Add Flecs observers
Expand Down
6 changes: 4 additions & 2 deletions src/vybe/jolt.clj
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@

(defn body-get
[phys body-id]
(-> (bodies-unsafe phys)
(get (bit-and body-id (jolt/JPC_BODY_ID_INDEX_BITS)))))
(let [body (-> (bodies-unsafe phys)
(get (bit-and body-id (jolt/JPC_BODY_ID_INDEX_BITS))))]
(when (and body (zero? (bit-and (vp/address body) (jolt/_JPC_IS_FREED_BODY_BIT))))
body)))

;; -- Query.
(defn cast-ray
Expand Down

0 comments on commit a716eb5

Please sign in to comment.