繁体   English   中英

Scenekit:动画时模型更改大小

[英]Scenekit: Model change size when animation

我使用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秒)来修复它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM