Okay, so I “thought” I had this all figured out. I understand that local rotations are rotations applied only to the model which are then modified by world rotations.
However, a little nack has been bugging me lately. I’ve been trying to implement my own version of inverse kinematics ( Yes, I know the new MechAnism, as I believe it is called, is coming out, but Unity is more of my learning ground at the moment. Where I experiment and learn and can then turn around and apply that somewhere else if need be.)
So, if I could get a little help with a few explanations.
I believe my “restrictions” (Example: Local X Rotation cannot be more than +90) on certain bone’s rotation should be applied locally, so that even if you rotate in the world then the axes can follow, but still never exceed their limit. Am I right in assuming that?
Another thing I’m confused about is if I should apply my IKRotations to the bone’s local or the bone’s world rotation, because if I’m right, local bone rotations are built up based on the skeleton, which are then transformed by the world rotations, so I should apply the rotations to the local rotation which will then be transformed by the world rotation.
I’d really like to know the whole story behind how Unity’s coordinates are transformed, but if you can give me a general idea on those two alone, it would be a great help.
Unity uses Quaternions for it’s rotations to avoid the gimbal lock issue, if you’re doing custom IK surely you’d need to be doing the same?
I’ve never written an IK system so not sure what it is you’re needing to change exactly.
Anyway, just making sure you’re aware that unity transforms have both a rotation property which is a Quaternion and a Vector3 eulerAngles property (which is what most gameplay scripters use for rotations) that when set it updates the transform’s rotation Quaternion so that rotations applied throughout the transform hierarchy don’t suffer gimbal lock problems. Also, you shouldn’t modify the rotation property thinking it’s x/y/z are angle degrees, that’ll lead to all sorts of problems.
That is probably your best bet. You need a deep mathematical understanding of Quaternions before you can even think about manipulating them through their x,y,z and w values.
I think the general gist of my topic has been obscured, I’m only asking if bones that a mesh are attached to are accumulated in the way that I think they are,
I’m not messing with quaternions directly.
In other words, if I apply a transformation to a bone in local space, will it already be transformed according to its parent bone and then transformed by my transformation and then transformed by the world transformations or will it have a different order.
I have to apply these rotations based on a point that is based in world space, but I assume that if I apply the correct rotations in local space which will then be transformed into world space, then my outcome will be the same.