- Home /
Forward Kinematics Question
Hi,
I have a kinematic chain in Unity3d with a root and some child joints. I have each joint rotation calculated with an external tool and I want to transfer it to unity. The problem is that my method works on some joints and not on the others. I realised that only works in joints that are direct child of the root. Also, rotating a fixed amount for each joint, does not rotate the same for all joints.
My method (for each non-root joint):
// get a quaternion from a 3x3 rotation matrix (custom function) Quaternion q = buildQuaternion( externalToolMatrix ); // qIni is the localRotation from parent jointTransform.localRotation = q * qIni;
Any ideas? I know this is a forward kinematic problem, where a joint rotation depends on its parent, but I don't know how to do this in Unity. Maybe with worldToLocalMatrix or something like that?
Thanks,
Ricard
Your question seems too narrow of focus or does not include enough details to provide a sufficient answer. Perhaps you should consider revising to add more information.
You have some tool that calculates some rotations, but are you sure it is correct? If you are, then your application of the output is incorrect. What coordinate space are the rotations relative to? If world-space, use Transform.rotation. If parent-relative, use Transform.localRotation. If relative to some root, treat the rotations as being in world space and multiply by the specified root's rotation. You multiply some initial rotation by q. Is q a delta rotation or is it the resultant rotation? Is your initial rotation correct and do you need it?