Advertisement

Skeletal animation: Rotating left and right arm gives different results

Started by December 05, 2023 09:14 PM
2 comments, last by snoken 11 months, 3 weeks ago

Hi,

I have a skeletal figure for animation. I have it set in the t-pose and I am quite confused about something. When I apply a rotation on the Y axis of 90 degrees, the left arm seems rotate inwards, while the right arm seems to go backwards.

I am completely unsure as to what might cause this kind of an issue and would appreciate any insight into what might be causing this and potential areas I could look into for checking.

CDN media
auto offsetMatrix = Mat4::Translate(vec3(offset_from_parent.x, offset_from_parent.y, offset_from_parent.z)); 
	
auto rotation = Mat4::RotateY(90.0f); // returns y rotation matrix with rotation in radians
auto global = Mat::Identity();

// Apply rotation only to the left and right arm
if(joint->jointName == "LeftArm" || joint->jointName == "RightArm")
{
    global = parentMatrix * offsetMatrix * rotation;
}

Short answer: That's fine.

Long answer: You assume we could just mirror the left body setup to get the right side. We could, e.g. by allowing a non uniform scale of (-1,1,1) to flip the x axis.
But if we do this, we break some useful other assumptions:
Our coordinate systems are all either right handed or left handed. The determinant of a orientation matrix is always positive.
We may also face technical issues:
Conversion from matrices with mixed handness to quaternions does not work, because a 3D rotation can not represent a flipping/mirroring effect.
Normals my point the wrong side.

That's just some examples i can come up with. It's actually less trouble to accept some angles go the other direction depending on the side.

To understand how the skeleton is set up and why sides behave differently, visualize the bone transforms.
I have this currently, or something similar:

See the elbows. The blue Z axis goes up on one but down on the other side, causing the same effect you have observed. To bend the arms i need positive or negative angles, depending on the side.
That's indeed annoying, but not really a problem.


Advertisement

Thank you for helping me understand and providing an insightful response once again!

This topic is closed to new replies.

Advertisement