How to rotate an SCNNode, after I get the skinner and bones

422 Views Asked by At

I have a rigged character, in a DAE (COLLADA) format, that I obtained from the Mixamo service.

I am attempting to programmatically pose the character, however I have not had success. I wrote a short program to change the characters originally posed position from a T-pose (looking straight ahead) to a head turned position. If I can get this far I hope to begin changing the characters position (posing).

I have two means of doing this. The first is getting the skinner finding the head bone and rotating it 45 degrees. The second is getting the skinner and applying an animation to the head bone.

I am able to find the reference for the skinner, skeleton and the head bone. When I rotate the bone, the characters head position does not change. However the debug statement shows there is a rotation on the bone. How do I get the character to rotate his head?

I have investigated the documentation for skinning https://developer.apple.com/documentation/scenekit/scnskinner

The character is on screen and when executed the output from the print statements in Xcode shows the rotation of the bone but the head did not turn. What am I missing?

There is a link to the Xcode project.
It is a small example, which includes the DAE and textures.

https://drive.google.com/open?id=1sXGUzK0zVR0DeRjQ3rjdgf6Yf72peQvk

1

There are 1 best solutions below

0
Rahul Iyer On

I had a similar problem. You don't need a skinner for those models. You just need to delete all the animations. Open the dae file in blender, and delete the animations. Save it. Import it in your project. And try again!

Just to help you understand what's going on:

  1. Take your existing project, and set the animation duration to 10 seconds or something really long.
  2. Adjust some property (set the Euler angle or upper left leg to some value).
  3. Run your project - you will see that the angle does change, but when its done it resets to the original T-pose.

Then delete the animations as I suggested above, and after importing the model run your project again.

This time your model will be in the new pose! XD Thanks for saving us so much time apple!