Skip to content

How to Properly Disable Sensors in Jolt Physics? #1477

Answered by jrouwe
samaursa asked this question in Q&A
Discussion options

You must be logged in to vote

RigidBody->SetIsSensor(false)

This changes the sensor into a normal rigid body so all simulated objects start colliding as if it were a solid object.

PhysicsSystem->GetBodyInterface().DeactivateBody(RigidBodyID)

This makes the sensor go to sleep. For sensors this means it doesn't detect sleeping bodies anymore, but it will still detect active ones.

I understand that I can use OnContactValidate combined with custom logic to handle the end-overlap callbacks and ignore any overlaps or end-overlaps reported by Jolt

Correct.

Is there a built-in way to achieve this behaviour in Jolt, or is my custom logic the only solution?

There are 2 ways:

  • Remove the sensor by calling BodyInterface::…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by samaursa
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