|
Quinn Epsilon
Registered User
Join date: 13 Sep 2005
Posts: 3
|
08-13-2007 07:10
I need a simple example that returns the X,Y,Z rotation an object has in degree's. Similar to the value found in the edit menu for objects.
What I am trying to do is have the object know it's current rotation and have it do certain things if it goes too far over, tips upside down, rolls some degree forward, and so on.
|
|
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
|
08-13-2007 10:09
1: Get the rotation rotation myRotation = llGetRot();
2: Convert to a normal rotation with X, Y and Z vector myRotationAsVector = llRot2Euler(myRotation);
3: Convert from radians to degrees: vector myRotationAsVector = myRotationAsVectorDegrees * RAD_TO_DEG;
Or join them all into 1 line: vector myRotation = llRot2Euler(llGetRot()) * RAD_TO_DEG;
Reverse: llSetRot(llEuler2Rot(myRotation * DEG_TO_RAD));
For your code, you may be able to work with the radians, which would save some time and bytes in code.
Lyn
|
|
Quinn Epsilon
Registered User
Join date: 13 Sep 2005
Posts: 3
|
08-13-2007 18:55
Ok thanks very much 
|