[Closed] Rotation in WorldSpace to Object space?
Unless I don’t understand what’s happening (a possibility) I need to know how to change a worldtransform rotation quat into an object transform quat.
When I use gettransform on a biped part I obtain a quat that is in the Worldtransform coordinate system. Trying to apply this to another biped (with Setrtransform) means it will be applied in World coordinates… which is okay if the bipeds are oriented the same. If they are facing away from each other, for example, the transform gets applied backwards (which is to say the limbs will rotate the same direction except that one biped is facing the other direction, resulting in some very awkward poses <g>).
I can’t just arbitrarily apply an inverse quat to the biped since it could be facing ANY direction – what I really need is to be able to take a world coordinates quat and convert it to an object’s coordinates quat which I could then apply to that biped as if it were a world coordinates quat (at least I think that’s what I need to do :>). Any ideas?
You may try looking at the topics “Modifier Sub-Object Transform Properties” and/or “Node Transform Properties” both have information and samples on converting/working with coordinate systems.
Hope that helps some,
-Eric
Thanks – I do appreciate the reply.
As it turned out (I’m hoping – as the man said trying to fly from the Empire State Building as he passed the 23rd floor, “So far, so good”) my problem was not world coordinates versus object coordinates, it was having to apply the bip com rotation first.
As long as I do this it seems to work (just for the sake of future folks searching these threads):
slidertime = 4f
mycom = biped.gettransform $‘bip01’ #rotation
mycom2 = biped.gettransform $‘bip02’ #rotation
myThigh = biped.gettransform $‘bip01 L Thigh’ #rotation
myThigh2 = biped.gettransform $‘bip02 L Thigh’ #rotation
mycalf = biped.gettransform $‘bip01 L Calf’ #rotation
mycalf2 = biped.gettransform $‘bip02 L Calf’ #rotation
myfoot = biped.gettransform $‘bip01 L Foot’ #rotation
myfoot2 = biped.gettransform $‘bip02 L Foot’ #rotation
slidertime = 15
invert_thigh = mythigh2 + (mycom2 – mycom)
invert_calf = mycalf2 + (mycom2 – mycom)
invert_foot = myfoot2 + (mycom2 – mycom)
biped.settransform $‘bip01 L thigh’ #rotation invert_thigh true
biped.settransform $‘bip01 L calf’ #rotation invert_calf true
biped.settransform $‘bip01 L foot’ #rotation invert_foot true
Time will tell if this works under all circumstances but so far I’m happy.
There is also a coordSys switch you can such as:
in coordSys parent
in coordSys world
in coordSys <node>
in coordSys <matrix3>
So you might be able to use biped.getTransform <node> #rotation and convert the quat to a matrix3 and then use that to do your rotation math. I think that’s what I did a while back.
or something.
-Dave
Thanks, Dave.
So if I understand you right, you’re saying that perhaps using in Coordsys parent might give me an absolute rotation for that part which I could then apply (using the same coordsys) to the other biped’s part? I’ll play around just to see, because if nothing more it would make for easier to read code (although what I am doing works I may not understand it a year from now – considering my age, I don’t know that I understand it now :>)