Why is SCNNode “jiggling” when dropped onto SCNPlane?

半城伤御伤魂 提交于 2019-12-05 14:49:31

I think i followed the same tutorial. I also had same result. Reason is because when the cube drops from higher place, it accelerates and doesnot exactly hit on the plane but passes through. If you scale down the cube to '1 mm' you can see box completely passes through plane and continue falling below plane.
You can try droping cube from nearer to the plane, box drops slower and this 'jiggling' will not occur. Or you can try with box with small height instead of plane.

I had the same problem i found out one solution.I was initializing the ARSCNView programmatically.I just removed those code and just added a ARSCNView in the storyboard joined it in my UIViewcontroller class using IBOutlet it worked like a charm.

Hope it helps anyone who is going through this problem. The same code is below.

@IBOutlet var sceneView: ARSCNView!

override func viewDidLoad() {
    super.viewDidLoad()
    self.sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints,ARSCNDebugOptions.showWorldOrigin]
    sceneView.delegate = self
    sceneView.showsStatistics = true
    let scene = SCNScene()
    sceneView.scene = scene

}

The "jiggling" is probably caused by an incorrect gravity vector. Try experimenting with setting the gravity of your scene.

For example, add this to your viewDidLoad function:

sceneView.scene.physicsWorld.gravity = SCNVector3Make(0.0, -1.0, 0.0)

I found that setting the gravity - either through code, or by loading an empty scene - resolves this issue.

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