gpt4 book ai didi

ios - Scenekit:动画时模型改变尺寸

转载 作者:行者123 更新时间:2023-11-29 05:59:26 26 4
gpt4 key购买 nike

我使用 Scenekit 来对模型进行动画处理(由 Blender 创建),但是模型在动画时会改变大小(在 Blender 中,效果很好)。 https://youtu.be/WCE_sXEyfXU

    let sceneView = SCNView(frame: self.view.frame)
sceneView.allowsCameraControl = true
self.view.addSubview(sceneView)

let manScene = SCNScene(named: "art.scnassets/man.dae", inDirectory: nil, options: nil)
sceneView.scene = manScene

let camera = SCNCamera()
let cameraNode = SCNNode()
cameraNode.camera = camera
cameraNode.position = SCNVector3(-3.0, 3.0, 3.0)

let light = SCNLight()
light.type = SCNLight.LightType.ambient
let lightNode = SCNNode()
lightNode.light = light
lightNode.position = SCNVector3(10, 10, 10)

manScene!.rootNode.addChildNode(cameraNode)

let oneLegAnimation = SCNAnimationPlayer.loadAnimation(fromSceneNamed: "art.scnassets/oneLeg.dae")
oneLegAnimation.animation.isCumulative = false
oneLegAnimation.stop()
manScene!.rootNode.addAnimationPlayer(oneLegAnimation, forKey: "man")
manScene!.rootNode.animationPlayer(forKey: "man")?.play()

谢谢!

最佳答案

我认为 Blender 和 Xcode 之间是有区别的。最后,我通过添加 IK 骨骼和大量关键帧(每 0.5 秒)修复了它。

关于ios - Scenekit:动画时模型改变尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54830873/

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