Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple rotation question

Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
12-26-2007 16:28
Please help!!

I failed geometry at school, and certainly haven't improved since then. I don't understand ANY of the Wiki entries about rotation, nor the posts I have found in here :o


I want to know whether my prim has been turned "upside down", ie: its x or y rotation will be more than 90 degrees.

My best attempt is still failing; it returns "0.000" no matter what I think the answer should be.

PLEASE HELP!!

My best attempt:
CODE

default
{
state_entry()
{
rotation myrotation = llGetRot();
llVecMag(<myrotation.x, myrotation.y, 0>);


if (llVecMag(<myrotation.x, myrotation.y, 0>) > PI_BY_TWO) {

llSay(0, "greater");
}

else
{
llSay(0, (string)myrotation.y);
}
}
}


Thanks ....
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
12-26-2007 16:31
Quickest way that I can think of:
CODE

am_i_upside_down()
{
vector up = llRot2Up(llGetRot());
if (up.z > 0.0) llOwnerSay("I am facing upwards!");
else llOwnerSay("I am facing downwards!");
}
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Cherry Hainsworth
Registered User
Join date: 31 Jul 2006
Posts: 125
12-26-2007 16:47
From: Ordinal Malaprop

CODE

am_i_upside_down()
{
vector up = llRot2Up(llGetRot());
if (up.z > 0.0) llOwnerSay("I am facing upwards!");
else llOwnerSay("I am facing downwards!");
}


Blimey, I didn't even know there *was* a Rot2Up!

Thanks a million!!! :D

Cherry.