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 ?
Hal Mueller
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.
来源:https://stackoverflow.com/questions/41309204/scenekit-scnphysicsbody-get-notified-of-resting