SCNTransaction 在 Scene Kit 中没有正确的动画 SWIFT

SCNTransaction not animating correctly in Scene Kit SWIFT

我试图在十秒内将对象从 y 坐标 0 移动到 y 坐标 10。对象是在 y 坐标 0 处创建的。问题是当动画开始时,对象弹出到结束位置大约一秒钟然后弹回起始位置并正确开始动画。为什么对象会立即移动到结束位置,如何防止这种情况发生?

//create box bottom
func createGrabBox() {
grabbottom = grabBox.rootNode.childNodeWithName("grabbottom", recursively: true)!
grabbottom.position.y = 0
grabbottom.geometry!.firstMaterial!.transparency = 0.5
grabbottom.physicsBody = SCNPhysicsBody(type: SCNPhysicsBodyType.Dynamic, shape: nil)
scene.rootNode.addChildNode(grabbottom)

//animation snippet
SCNTransaction.begin()
SCNTransaction.setAnimationDuration(10.0)
SCNTransaction.setCompletionBlock() { }
grabbottom.position.y = 10
SCNTransaction.commit()

}

您不能操纵动态物体的位置。为此使用运动体。