Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

SetRot help please

Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
02-04-2007 21:24
I need help with SetRot..

How do I set the rotation of an object to 0,0,0 ?


Here's what I have now..


default
{
state_entry()
{
llSay(0, "turning on!";);
llTargetOmega(<0,.5,1>,0.9,PI);
}
touch_start(integer total_number) // when i'm touched..
{
state off; // sets the script to a new "state" an starts running "state off"
}
} // this curly bracket ends the body default the default state.

state off // a second state besides "default"
{
state_entry()
{
llSay(0, "turning off!";);
llTargetOmega(<0,.5,1>,0.0,PI);
llSetRot(<0,0,0>;);
}
touch_start(integer total_number) // when i'm touched..
{
state default; // sets the script to a new "state" and starts running "state on"
}
} // this curly bracket ends the body of the off state.
Lightwave Valkyrie
Registered User
Join date: 30 Jan 2004
Posts: 666
02-04-2007 23:14
from wiki: A rotation is a variable type comprised of 4 floats used together as a single item. This data is interpreted as a quaternion
use this to convert to the 3 rotation form you were using:
CODE
vector eul = <0,0,0>; //0 degrees 0, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llSetRot(quat); //rotate the object

-LW
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
02-04-2007 23:21
There is also a nice little shortcut useful here - the constant "ZERO_ROTATION", i.e. llSetRot(ZERO_ROTATION);
_____________________
Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
thanks
02-05-2007 09:03
yeah, I was reading the section on rotation, and the quanteron, but I wasn't quite understanding how to put it to use..

I will try the zero rotation thing later today when I get home.

Thanks,
Shippley
Shippley Dittmann
Registered User
Join date: 30 Aug 2006
Posts: 13
This doesnt make the object go back to "Zero Rotation"
02-05-2007 17:05
default
{
state_entry()
{
llSay(0, "turning on!";);
llTargetOmega(<0,.5,1>,0.9,PI);
llSetTimerEvent(3.0);
}

timer()
{
llSetColor(<llFrand(1),llFrand(1),llFrand(1)>, ALL_SIDES);
}
touch_start(integer total_number) // when i'm touched..
{
state off; // sets the script to a new "state" an starts running "state off"
}
} // this curly bracket ends the body default the default state.

state off // a second state besides "default"
{
state_entry()
{
llSay(0, "turning off!";);
llTargetOmega(<0,.5,1>,0.0,PI);
vector eul = <0,0,0>; //0 degrees 0, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llSetRot(quat); //rotate the object
}
touch_start(integer total_number) // when i'm touched..
{
state default; // sets the script to a new "state" and starts running "state on"
}
} // this curly bracket ends the body of the off state.