I am trying to make an app that uses 3D physics and detects when the various nodes in the scene have all come to rest. The logical way to do this would seem to be testing their isResting property on their physics body. However, no matter how stationary the objects are, this value is never set. I have checked that allowsResting is true and am testing the attribute as follows, but I have never seen even one object 'at rest' despite logging out its status on each update. I've also tried putting this in the didRender function. Anyone got any ideas as to why isResting never seems to be set?
var isTotallyAtRest = false
func renderer(aRenderer: SCNSceneRenderer, didSimulatePhysicsAtTime time: NSTimeInterval) {
for object in allObjects {
if let physics = object {
if physics.isResting == false {return}
}
}
isTotallyAtRest = true
}