Rotating the character's head

163 views
Skip to first unread message

erike...@gmail.com

unread,
Dec 7, 2013, 12:54:54 PM12/7/13
to urh...@googlegroups.com
Hi, I would like to rotate the head node/bone of my character, actually just the pitch. I know how to do it when no animation is playing:

node.GetChild("mixamorig_Head", true).rotation = Quaternion(-controls.pitch, Vector3(1.0f, 0.0f, 0.0f));

But when I enable animations for the character, the animations apparently overwrite the rotation settings. I've also played around with the head bone's initialRotation parameter, but that didn't seem to do it either.

What do I need to do?

Thanks

Lasse Öörni

unread,
Dec 7, 2013, 2:07:41 PM12/7/13
to urh...@googlegroups.com
Set the "animated" property of the head bone to false and the animation should no longer update it at all.

 

erike...@gmail.com

unread,
Dec 7, 2013, 3:44:52 PM12/7/13
to urh...@googlegroups.com
Thanks, that did it!

Mike

unread,
Jan 15, 2014, 1:19:34 PM1/15/14
to urh...@googlegroups.com
I'm trying to make the head of a character follow another character.
I've tried using Quaternion(character1.position, character2.position) but this doesn't work as expected.
Any hints?

reat...@gmail.com

unread,
Jan 15, 2014, 1:52:52 PM1/15/14
to urh...@googlegroups.com
You can use this:
/// Look at a target world position.
void Node::LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP);

Now you are using this:
/// Construct from the rotation difference between two vectors.
Quaternion(const Vector3& start, const Vector3& end)

Mike

unread,
Jan 15, 2014, 2:57:23 PM1/15/14
to urh...@googlegroups.com

Thanks Reattiva,

I've already tested with LookAt function. It works fine for the whole character node, but not for the head node.

Lasse Öörni

unread,
Jan 15, 2014, 3:31:58 PM1/15/14
to urh...@googlegroups.com
The LookAt function assumes that you want to orient the node's forward direction (which is positive Z by convention) toward the target.

Depending on how the head bone is authored it may have some another convention. One way to fix is to adjust the rotation after LookAt() by some hack quaternion that corrects the mismatch. You may require trial & error for that.

li xin

unread,
Jan 15, 2014, 7:58:38 PM1/15/14
to urh...@googlegroups.com

 node.GetChild("mixamorig_Head", true).rotation = ...
  
    this is doing in local space, but your rotation to target is caculated in world space, 
    you can try node.GetChild("mixamorig_Head", true).worldRotation = target rotation you caculated. 

Mike

unread,
Jan 17, 2014, 5:02:17 AM1/17/14
to urh...@googlegroups.com

Lasse Öörni wrote:
One way to fix is to adjust the rotation after LookAt() by some hack quaternion that corrects the mismatch. You may require trial & error for that.

Many thanks Lasse, works perfectly.
For reference I'll post the settings for Jack in the new discussion forum.

Reply all
Reply to author
Forward
0 new messages