Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

a little help with rotations

Marcthur Goosson
Registered User
Join date: 14 Feb 2007
Posts: 17
08-11-2008 05:24
Hi all experts out there :-)

This is my script and i would love to have those rotation in DECIMAL DEGREES.
Those radians drive me crazy :-(
TNX for tips or tricks or even solutions.


----------------------------------------------------------------------

string object;

default
{
touch_start(integer count)
{

object=llGetInventoryName(INVENTORY_OBJECT,0);

llRezObject(object, llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>,
this is in radial degrees and I would like to have decimals <00.0,00.0,00.0,0.0>, 0);
}
object_rez(key id)
{

}
}
----------------------------------------------------------------------------------------
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
08-11-2008 06:02
I'm not in-world at the moment, but the two things you need to look up are:

llEuler2Rot

and

DEG_TO_RAD


They can be combined such as:

llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD)


I'm still trying to get my head around some of this rotation stuff too. :-)
_____________________
Visit ChereeMotion - Life's Best Pinup Poses
http://slurl.com/secondlife/Wild%20Rice/38/230/51
Very Keynes
LSL is a Virus
Join date: 6 May 2006
Posts: 484
08-11-2008 06:02
I am no expert on rotations but there is a built in way of converting.

This is from the Wiki if it helps

float DEG_TO_RAD

A constant used to convert from degrees to radians through multiplication.
The constant amounts to PI / 180.

Examples:
float radians = degrees * DEG_TO_RAD;

vector euler_rot = <45, 90, 0> * DEG_TO_RAD;

Compare with RAD_TO_DEG.
Marcthur Goosson
Registered User
Join date: 14 Feb 2007
Posts: 17
how to implement
08-11-2008 06:52
They can be combined such as:

llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD)


If I only knew how to implement this in my script.
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
08-11-2008 07:04
From: Marcthur Goosson
Hi all experts out there :-)

This is my script and i would love to have those rotation in DECIMAL DEGREES.
Those radians drive me crazy :-(
TNX for tips or tricks or even solutions.


----------------------------------------------------------------------

string object;

default
{
touch_start(integer count)
{

object=llGetInventoryName(INVENTORY_OBJECT,0);

llRezObject(object, llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>,
this is in radial degrees and I would like to have decimals <00.0,00.0,00.0,0.0>, 0);
}
object_rez(key id)
{

}
}
----------------------------------------------------------------------------------------


Try something like this:

llRezObject(object, llGetPos() + <0.0,0.0,1.0>, <0.0,0.0,0.0>, llEuler2Rot(<45.0, 30.0, 90.0> * DEG_TO_RAD) , 0);
_____________________
Visit ChereeMotion - Life's Best Pinup Poses
http://slurl.com/secondlife/Wild%20Rice/38/230/51
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
08-11-2008 07:04
From: someone
llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD)
This simply takes a 3-axis rotation (a "Euler", the <1.0,2.0,3.0> part) which is expressed in degrees, converts it to radians, and converts that into a rotation datatype. Plug that in, with your desired axis rotations (in degrees), where the rotation type is expected.

(edit to add: )
From: someone
this is in radial degrees and I would like to have decimals <00.0,00.0,00.0,0.0>
Actually, no. Quaternion components do not directly represent radians or degrees. Without devling too deeply into the math involved, it's just easier to use the llEuler2Rot function to build one from a euler vector, which is easier to comprehend, especially for those used to the rotation editor in the client.
Marcthur Goosson
Registered User
Join date: 14 Feb 2007
Posts: 17
jump of joy
08-11-2008 07:16
YEAH YEAH I AM HAPPY

It works perfectly now.
I am so glad to be a nerd sometime :-)

TNX for making me smile !!

Marcthur