Skip to content

ContactListener events lifetime #1279

Answered by jrouwe
Froyok asked this question in Q&A
Sep 25, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote
  • OnContactValidate - you need to immediately provide a response, so this one cannot be queued
  • OnContactAdded/Persisted - as long as you don't destroy the bodies yourself, the bodies should remain valid. ContactManifold is allocated on the stack, so need to be copied. ContactSettings needs to be filled in immediately by the callback, so there's no point in storing this.
  • OnContactRemoved - this one only gets IDs, these can point to already deleted bodies. When you try to get a Body pointer from an ID the system will let you know they no longer exist, so you can queue these too.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Froyok
Comment options

Answer selected by Froyok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants