Skip to content

What does the data in a collision event mean? #130

Answered by a-type
a-type asked this question in Q&A
Discussion options

You must be logged in to vote

For anyone else looking, I think I found the answer in cannon-es source:

https://github.com/pmndrs/cannon-es/blob/master/src/equations/ContactEquation.ts#L16

  ri: Vec3 // World-oriented vector that goes from the center of bi to the contact point.
  rj: Vec3 // World-oriented vector that starts in body j position and goes to the contact point.
  ni: Vec3 // Contact normal, pointing out of body I.

Will update once I understand which body is i and which is j in relation to the contact event.

Update: maybe I'm reading this wrong, but it... looks like there's no way to really tell which body is i vs j for any particular contact event. The contact itself would normally have bi and bj fields, …

Replies: 1 comment 1 reply

Comment options

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

Answer selected by stockhuman
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