Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Get 'y' rotation of an object and convert into vector.

Guido Columbia
Registered User
Join date: 25 Oct 2005
Posts: 102
04-30-2006 17:11
A simple modified example from the scripting WIKI:

setrot(integer a)
{
vector eul = <0, 0, a>;
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot(eul);
llSetRot(quat);
}


Calling ' setrot(90); ' will set the z rotation to 90 degrees.

I also want to get the current 'y' rotation in vector form and pass it into this function.

setrot(integer a)
{
vector currot = ?????? //define currot in vector form
vector eul = <0, currot.y, a>;
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot(eul);
llSetRot(quat);
}



Basically I want to rotate an object on its z axis as defined by ' a ' while preserving the current 'y' rotation.

I could probally figure it out if the grid was online, but ah well.. Thanks in advance for your help.
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
04-30-2006 17:25
From: Guido Columbia
vector currot = ?????? //define currot in vector form


Try:

vector currot = llRot2Euler (llGetRot ());
Guido Columbia
Registered User
Join date: 25 Oct 2005
Posts: 102
04-30-2006 18:09
Pretty sure I tried that and got very unexpected results. I will play with it more when the grid comes back up. I'm pretty sure I can accomplish it, but I have to play with it a bit.. Thanks for your help. =)