How do you set a local rotation for 1 axis but keep the other axis world space untouched?,How do you set the local rotation of 1 axis without effecting the world rotation of others?

I have an inverse kinematics rig with the animation rigging package and I need the forearm to rotate on the y axis (along the arm) locally. However, Unity doesn’t seem to have any functions for only setting the local axis. They have Transform.Rotate which is close, that rotates around the local axis according to a CHANGE but I need to SET it.

Another similar function I saw was Quaternion.AngleAxis but that doesn’t seem to work either since it wants to completely reset my rotation and my arm points straight up, removing the work of the inverse kinematics.

Perhaps it’s my lack of knowledge in Quaternions, if anyone has an answer that would be great!

Thank you,I have an inverse kinematics setup for my VR rig and I need to keep the rotations for my forearm all the same besides the local Y axis (down the arm) to make it rotate depending on how your hand is facing.

There’s not very many functions available for Quaternions that I could see for this and I can’t use something like Transform.Rotate since this would result in it being a change in value compared to setting the value.

Really lost on what to do now so if anyone could help me with the math that would be great. Maybe I’m just not understanding Quaternions since they are rather complicated.

You simply plug the original rotational values back into it like this:

transform.localRotation = Quaternion.Euler(transform.localRotation.x, yAngle, transform.localRotation.z);