SceneKit: isResting never returns true

牧云@^-^@ 提交于 2019-12-22 09:20:11

问题


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
    }

来源:https://stackoverflow.com/questions/31944940/scenekit-isresting-never-returns-true

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!