Hi, in my Nape objects in CitrusEngine i have the handleBeginContact and handleEndContact, is there a way to easily manage persisted contact?
CitrusEngine Nape Collision Persists?
(5 posts) (2 voices)-
Posted 1 year ago #
-
Hi Jacowaco,
I think we've removed it by default, but you still can add an InteractionListener on the nape space being used to use nape's CbEvent.ONGOING event type so you'd get constant calls between begin and end of contacts.
You can do this on a per object basis, it has just been decided that all NapePhysicsObject shouldn't have them by default.
This is an old class but you can see how it is implemented by Aymeric in this example :
https://github.com/DaVikingCode/Citrus-Engine-Examples/blob/master/src/games/osmos/Atom.as#L50
Posted 1 year ago # -
Great! That is the answer i needed. Thanks!
EDIT: Did you exclude it because it consumes resources?
Posted 1 year ago # -
Sorry didn't see your edit,
I guess the cons are that this was not used much + one could sometimes just have a flag set to true on begin contact and false on exit , or simply an array of colliding object and treating that in an update if necessary, instead of having this empty listener called by default for every NapePhysicsObject.
We could've used some sort of reflection to check if a class extending NapePhysicsObject is actually implementing an on going listener to hook it up to the space I guess.
Posted 1 year ago # -
I understand, thanks!
Posted 1 year ago #
Reply
You must log in to post.