gpt4 book ai didi

swift - RealityKit – 动画循环变换

转载 作者:行者123 更新时间:2023-12-05 06:20:24 24 4
gpt4 key购买 nike

我不知道如何让下面的移动函数重复,以便在简单的 meshResource 上创建一个恒定的旋转。有什么建议吗?

var transform = sphereEntity.transform
transform.rotation = simd_quatf(angle: .pi, axis: [0,1,0])
let anim = sphereEntity.move(to: transform, relativeTo: sphereEntity.parent, duration: 5.0)

最佳答案

.move() 实例方法在添加到场景的线实体之后开始工作。

let boxEntity = ModelEntity(mesh: .generateBox(size: 1.0), 
materials: [SimpleMaterial()])

var transform = boxEntity.transform

transform.rotation = simd_quatf(angle: .pi, axis: [0, 1, 0])

let boxAnchor = AnchorEntity()
boxAnchor.children.append(boxEntity)
arView.scene.anchors.append(boxAnchor)

boxEntity.move(to: transform, relativeTo: nil, duration: 5.0)

At the moment (December 23, 2022) all RealityKit's .move() methods still can't loop.

关于swift - RealityKit – 动画循环变换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60514348/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com