Skip to content

Sensor per shape #236

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

You must be logged in to vote

In most cases you would create a body with mIsSensor = true to make it a sensor for all other bodies, but you can override OnContactAdded and OnContactPersisted to set ioSettings.mIsSensor = true to make a specific contact act as a sensor.

Note that it is possible for contacts to be merged, so you may not get a callback for every (inBody1, inManifold.mSubShapeID1, inBody2, inManifold.mSubShapeID2) pair if the contacts have the same normal. Contact merging can be turned off with PhysicsSettings::mUseManifoldReduction = false, but this comes at a big performance cost.

In general, if you want to have a sensor attached to a normal body, I would recommend to create a 2nd body that is a sensor …

Replies: 1 comment 1 reply

Comment options

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

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