Skip to content

Commit

Permalink
Allow retreival of surface velocity for 2d collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
borodust committed Apr 12, 2020
1 parent 20638b4 commit 5ba6cb1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions physics/2d/contact.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
(%cp:arbiter-set-surface-velocity *arbiter* vec))
value)

(defmethod simulation-engine-collision-surface-velocity ((engine chipmunk-engine))
(with-cp-vect (vec)
(%cp:arbiter-get-surface-velocity vec *arbiter*)
(init-bodge-vec (vec2) vec)))

(defmethod simulation-engine-contact-normal ((engine chipmunk-engine))
(declare (ignore engine)))
(defmethod simulation-engine-contact-point ((engine chipmunk-engine))
Expand Down
4 changes: 4 additions & 0 deletions physics/api.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@
(setf (simulation-engine-collision-surface-velocity *engine*) value))


(defun collision-surface-velocity ()
(simulation-engine-collision-surface-velocity *engine*))


(defun has-next-shape-contact ())


Expand Down
1 change: 1 addition & 0 deletions physics/backend/backend.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
(defgeneric (setf simulation-engine-collision-friction) (value engine))
(defgeneric (setf simulation-engine-collision-elasticity) (value engine))
(defgeneric (setf simulation-engine-collision-surface-velocity) (value engine))
(defgeneric simulation-engine-collision-surface-velocity (engine))

(defgeneric simulation-engine-contact-normal (engine))
(defgeneric simulation-engine-contact-point (engine))
Expand Down

0 comments on commit 5ba6cb1

Please sign in to comment.