SceneKit SCNPhysicsBody get notified of resting

361 views Asked by At

SceneKit Is there a way to get notified when dynamicBody is in resting State ? I want to remove dynamicBody when it finished to fall to the ground and stopped moving completely - I presume that I will have quite large amount of those so I would like to use something event based rather than looping through all the bodies and checking their velocities ?

1

There are 1 answers

4
Hal Mueller On BEST ANSWER

You could use Key-Value Observation on the isResting property. See Is key-value observation (KVO) available in Swift?.

Or you could use the SCNPhysicsContact and SCNPhysicsContactDelegate to detect collisions with the floor, and use that to trigger a check for velocity.