I use Scenekit to animate a model (created by Blender), but the model changes size when animation (in Blender, it works fine). 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()
Thanks!
I think there is a difference between Blender and Xcode. In the end, i fixed it by add IK bone and a lot of keyframe (every 0,5 second).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.