|
For some reason I can't seem to wrap my head around this problem. Basically I have a series of quaternion orientations being supplied to Unity3D from an external program. The orientations are being pulled from a mocap system I'm using. The orientations I get from the system are relative to a single global coordinate system. So they aren't related to any sort of parent transform. The problem that I'm having is that I can't figure out where to supply my transformations. Because they aren't cumulative (IE, each orientation I get is the actual orientation and not the change since the last one) I can't use the update methods supplied.
(comments are locked)
|
|
Here is the snippet of code that will give the localRotation of a child relative to its parent if you have the 2 world rotations. childObj.transform.localRotation = Quaternion.Inverse(childObj.transform.parent.rotation) * theChild.transform.rotation
(comments are locked)
|
|
You could convert the absolute rotation to a relative rotation by multiplying it with the inverse of the current rotation. Hmm, I'm a touch confused. Doesn't that just subtract out the current rotation from the absolute rotation? So if I've already rotated 45 degrees about X and I tell it to rotate 90 about X it will only rotate another 45? This is fine except for 2 things: 1.) The current rotation of my object's limb was set in 3DS Max. So the base rotation for the arm, for example, is already at Euler(5,5,0). When I rotate that by 90 around X it should be 90 + what I already have. 2.) This doesn't seem take in to account if I rotate my person in the scene.
Feb 14 '10 at 11:34 PM
Jerdak
(comments are locked)
|
|
I'll be the first to admit my understanding of all of this is tenuous at best. The following is my solution. Visually it seems to work as I want. The part I find slightly off is the conversion of the quaternion axis by the current base orientation. I did this on a whim to see what would happen. Oh and for some reason it won't rotate about the x-axis unless I update the z value of my quaternion?
(comments are locked)
|
