Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do I add rotation on RezObjext ?

Mel Cramer
Registered User
Join date: 29 Apr 2006
Posts: 24
05-27-2006 05:00
I want to rez an object and then have it rotated 90 in the y axis

I assume I must replace ZERO_ROTATION with something

llRezObject("something", llGetPos() + <0, 0, 2>, ZERO_VECTOR, ZERO_ROTATION, 42);

sorry for noob question !
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
05-27-2006 05:39
From: someone
llRezObject("something", llGetPos() + <0, 0, 2>, ZERO_VECTOR, ZERO_ROTATION, 42);


Becomes

CODE

llRezObject("something", llGetPos() + <0, 0, 2>, ZERO_VECTOR, llEuler2Rot(<0,90,0> * DEG_TO_RAD), 42);


the <0,90,0> is the rotation as a vector in Euler (x,y,z) coordinates and the DEG_TO_RAD turns this into Radians, the llEuler2Rot() turns this into a Rotation which is the form in which you can set rotations in LSL.

Also see:
http://secondlife.com/badgeo/wakka.php?wakka=rotation

in fact, the clearer way of showing this would be:

CODE

vector eul = <0,90,0>; //90 degrees around the y-axis, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llRezObject("something", llGetPos() + <0, 0, 2>, ZERO_VECTOR, quat, 42);
Mel Cramer
Registered User
Join date: 29 Apr 2006
Posts: 24
05-27-2006 05:55
Yikes! I am only a poor Taff from South Wales don't you know.

I new I should have paid more attention to my maths teacher !

Thanks it is now working ok