Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rotaion about 3 axis

Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
09-17-2007 22:14
Is it possible to rotate about all three axis simultaneously or is it necessary to do three separate rotations?

I ask because this...

llRezObject( name, pos, ZERO_VECTOR, llEuler2Rot( <rx,ry,rz>;), 0);

...gives nonsensical results, while this...

llRezObject( name, pos, ZERO_VECTOR, llEuler2Rot( <rx,0,0>;) * llEuler2Rot( <0,ry,0>;) * llEuler2Rot( <0,0,rz>;), 0);

...works sometimes.

All the examples in the wiki work on one axis at a time. Is that because it's not possible to do otherwise?
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
09-18-2007 01:21
rotations work in radians, not degress.. try this

vector MyVector = <1,2,3>;
MyVector *= DEG_TO_RAD;
rotation MyRotation = llEuler2Rot(MyVector);
llSetRot (MyRotation);

that' should solve your 'nonsensical' rotations :)
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
09-18-2007 02:33
From: Johan Laurasia
that' should solve your 'nonsensical' rotations :)


It doesn't. My calculations are in radians, not degrees.

By nonsensical I mean that the z-axis rotation seems to be calculated based on local coordinates, whereas x & y are global. That is, it looks like the rezzed object was rotated about global x and y, and then around its own local z axis. Unless I do each degree of freedom separately. My source object is aligned to the grid such that its local and global coordinate systems are aligned, so multiplying by llGetRot has no effect.
Lordly Binder
Registered User
Join date: 29 May 2007
Posts: 4
Math misunderstanding
09-18-2007 08:55
I think maybe the problem is in thinking that a Euler rotation is a simple 3-axis rotation as in Pitch/Roll/Yaw. But it is not. I would suggest that the mathematics wiki on Euler rotations be consulted as they have a great little graphical representation of a full Euler rotation and formulae for the conversion to/from quaternians.
http://en.wikipedia.org/wiki/Euler_angles
Might help a little I hope.

Lordly
Anya Ristow
Vengeance Studio
Join date: 21 Sep 2006
Posts: 1,243
09-18-2007 14:17
If eulers in SL really are eulers, then both the LL and rpgstats wikis are wrong. Will consider this next time I do battle with rotations. Thanks, Lordly.