Explanation of what getTransform() returns
by Joey Skinner · in Technical Issues · 03/31/2006 (10:26 am) · 6 replies
I've done some searching through the forums and have found some explanation of what it returns. Here is a summary of what I've found (question follows):
x y z rotx roty rotz angle
where x, y, and z are the position
One post said that if rotx=0 and roty=0 and rotz=1 and angle=30 that the object would be rotated around the z axis by 30 degrees. This doesn't seem right to me for 3 reasons.
First of all, from looking at this for an object in the console, it seems like the angle is in radians and not degrees.
Second, in the console, if I change rotx or roty to have a value of 1 with the others being zero, it still rotates the same.
Third, if this is the transform for each object, how can it possibly represent the possible orientations around all the axii at the same time?
Question: Can anyone give me a brief summary of what the fields are and how different rotations are represented? I've read the detailed descriptions and FAQ's about quaternion math. I'm just confused at what is represented by the Transform matrix.
x y z rotx roty rotz angle
where x, y, and z are the position
One post said that if rotx=0 and roty=0 and rotz=1 and angle=30 that the object would be rotated around the z axis by 30 degrees. This doesn't seem right to me for 3 reasons.
First of all, from looking at this for an object in the console, it seems like the angle is in radians and not degrees.
Second, in the console, if I change rotx or roty to have a value of 1 with the others being zero, it still rotates the same.
Third, if this is the transform for each object, how can it possibly represent the possible orientations around all the axii at the same time?
Question: Can anyone give me a brief summary of what the fields are and how different rotations are represented? I've read the detailed descriptions and FAQ's about quaternion math. I'm just confused at what is represented by the Transform matrix.
#2
Thank you. This makes it clearer to me. Is the range of the rotx-z values from 0-to-1 or -1-to-1?
03/31/2006 (11:16 am)
@Orion,Thank you. This makes it clearer to me. Is the range of the rotx-z values from 0-to-1 or -1-to-1?
#3
remember that rotx-z are specifying an axis, AKA a vector.
the vector will be normalized before actually doing the rotation (i believe)
- OOPS - actually i'm wrong. looks like it's *not* normalized,
which means that you are responsible for making sure that the length of the vector is one.
- which is fortunately easy for the cardinal axes: just use ones and zeros.
eg
1 0 0 = x
0 1 0 = y
0 0 1 = z
if you want to rotate around a more exotic axis like 1 1 1,
you'll want to first normalize the "1 1 1" via something like:
%axis = "1 1 1";
%axis = VectorNormalize(%axis);
- any experts out there, correct me if i'm mistaken.
03/31/2006 (12:54 pm)
The range of each component is actually unbounded.remember that rotx-z are specifying an axis, AKA a vector.
the vector will be normalized before actually doing the rotation (i believe)
- OOPS - actually i'm wrong. looks like it's *not* normalized,
which means that you are responsible for making sure that the length of the vector is one.
- which is fortunately easy for the cardinal axes: just use ones and zeros.
eg
1 0 0 = x
0 1 0 = y
0 0 1 = z
if you want to rotate around a more exotic axis like 1 1 1,
you'll want to first normalize the "1 1 1" via something like:
%axis = "1 1 1";
%axis = VectorNormalize(%axis);
- any experts out there, correct me if i'm mistaken.
#4
The final thing I'm trying to do, and maybe there is an easier way to get there, is to rotate an Item to point to the player's position no matter where the player moves to. Even when that player is on higher ground than the Item which is why I need it to not only rotate around the z axis but also to "tilt" up or down.
I assume that having an object point to another's position is a fairly common thing. I'd love to hear of a utility function/method to do it other than me writing the code to figure out the angle between the current orientation and the player object. Actually the math doesn't bother me, its figuring out how to use trig with the Transform information hence all my questions about what the Transform is.
03/31/2006 (1:15 pm)
Using this information and setTransform(), I can still never get an Item object to face any angles other than rotating around the z axis. Maybe Items have some type of gravity check to make sure they never tilt or roll.The final thing I'm trying to do, and maybe there is an easier way to get there, is to rotate an Item to point to the player's position no matter where the player moves to. Even when that player is on higher ground than the Item which is why I need it to not only rotate around the z axis but also to "tilt" up or down.
I assume that having an object point to another's position is a fairly common thing. I'd love to hear of a utility function/method to do it other than me writing the code to figure out the angle between the current orientation and the player object. Actually the math doesn't bother me, its figuring out how to use trig with the Transform information hence all my questions about what the Transform is.
#5
You should be able to use WheeledVehicle/Vehicle as a comparison basis for having non-clamped axes of rotation.
03/31/2006 (3:25 pm)
The Item class as well as the Player class clamp rotations about the X and Y axes,and in fact never transmit them to the client at all. You will need to modify this in your source code (check both the processTick() and the packUpdate/unpackUpdate methods) to see where it is being clamped.You should be able to use WheeledVehicle/Vehicle as a comparison basis for having non-clamped axes of rotation.
#6
03/31/2006 (3:42 pm)
OK. I'll check the code to see how to unclamp this so I can get the other axis of rotation. What about utility functions or code to look at which allows one object to face another? Even if only in one axis.
Associate Orion Elenzil
Real Life Plus
rotX rotY rotZ specify an _axis_ of rotation,
and angle is either radians or degrees around that axis, i forget which.
eg (assuming degrees)
"1 0 0 90" = 90 degrees around X.
"1 1 1 90" = 90 degrees around the vector from 0 0 0 to 1 1 1.
one reason you may not have seen an effect when you changed rotx/roty would have been if the object was a player object. player objects always auto-orient vertically, so only rotation around Z will have effect.