【问题标题】:How do I move an Entity back to its initial position如何将实体移回其初始位置
【发布时间】:2020-04-17 19:46:03
【问题描述】:

对球施加线性脉冲和扭矩后,我试图将球移回其初始位置。

在从 Reality Composer 加载场景时,我将球的初始变换存储在此处

Experience.loadTestSphereAsync { (result) in
            switch result {
            case .success(let anchor):
                anchor.generateCollisionShapes(recursive: true)
                self.testSphereAnchor = anchor
                self.ball?.physicsBody?.mode = .static
                self.arView.scene.anchors.append(self.testSphereAnchor)
                self.ballStartTransform = self.testSphereAnchor.ball?.transform
                self.targetStartTransform = self.testSphereAnchor.target?.transform
                self.addTapGestures()
            case .failure(let error):
                fatalError(error.localizedDescription)
            }
        }

要将球移回原来的位置,我正在这样做

func didPressRestartButton() {
        ball?.clearForcesAndTorques()
        ball?.physicsBody?.mode = .static
        ball?.move(to: ballStartTransform!, relativeTo: nil, duration: 0.3)
    }

球并没有回到原来的位置,而是冻结在原处。

【问题讨论】:

    标签: ios swift arkit realitykit reality-composer


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-28
      • 1970-01-01
      相关资源
      最近更新 更多