Animation SceneKit SCNNode位置不起作用

问题描述 投票:0回答:1

我完全遵循此:https://developer.apple.com/documentation/scenekit/animation/animating_scenekit_content

我在另一个具有用户面部几何形状的SCNNode上具有一个SCNNode。

位于面部SCNNode上的SCNNode,我希望对动画进行动画处理。我正在调用此函数,该函数位于要设置动画的SCNNode的子类中。它需要的属性是在脸上的位置。此功能根本不起作用:

 func move(to vertex: SCNVector3) {
  let animation = CABasicAnimation(keyPath: "move")
  animation.fromValue = SCNVector3(self.position.x, self.position.y, self.position.z)
  animation.toValue = vertex
  animation.duration = 3.0
  self.addAnimation(animation, forKey: "move")
 }

此功能运行良好:

 func move(to vertex: SCNVector3) {
  self.position.x = vertex.x
  self.position.y = vertex.y
  self.position.z = vertex.z
 }

对两个函数的函数调用:

move(to: SCNVector3(anchor.geometry.vertices[Node.oldVertexPos].x, anchor.geometry.vertices[Node.oldVertexPos].y, anchor.geometry.vertices[Node.oldVertexPos].z))
ios swift animation cabasicanimation scnnode
1个回答
0
投票
let animation = CABasicAnimation(keyPath: "position")
© www.soinside.com 2019 - 2024. All rights reserved.