Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help understanding rotational values

Nexus Laguna
Registered User
Join date: 20 Dec 2006
Posts: 40
04-28-2007 04:26
I have searched the two LSL wikis but the information they give doesn't seem to entirely understandable (or I'm an idiot). I have not in the past had to do much work with rotations but am now doing a project for a friend but find the whole <x, y, z, s> rotational scheme confusing. What I really want to know is how does changing the values x, y, z and s affect the rotation of a prim, and what magnitudes perform certain types of rotations.

The project I am working involves rotating an invisible root prim to make its child prim perform certain actions. So far I understand the fact that you add your own change in rotation to the existing rotation the prim has, but the results from changing values of x, y, z and s aren't intuitive to me.

Any help will be appreciated. :)
Stukas Zephaniah
Registered User
Join date: 13 Oct 2006
Posts: 40
04-28-2007 08:46
Read up on quaternions, there's no simple way to explain it.. sry :)

But you can use llRot2Eueler() and llEuler2Rot() so you can work with 3 values instead of 4.
That may help you.

- Stukas
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
04-28-2007 12:42
aye, quaternions while very confusing for the user are very simple for the computer.


my *best* understanding is that the x,y,z values are a unit vector (length of 1) along which the original Z axis of the object points, and the S values is how many radians the object is rotated about it's Z axis.


so essentially, a quaternion is turning the object around it's Z axis, and then pointing the Z axis along a unit vector.


I could be wrong, but that's the way I've come to conceptualize the quaternion in SL
_____________________
My SLExchange shop

Typos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not.


The function is working perfectly fine. It's just not working the way you wanted it to work.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
I'm no expert...
04-28-2007 13:42
I think you are looking for something like

CODE
rotation r = llGetRot(); //get root rpim's current rotation
rotation q = //....additional rotation you want (more below)

llSetRot( r*q );


q can be easily constructed from an Euler vector, <x,y,z>. For example, 90 degrees around the local X axis and 20 degrees around the local Y axis is

CODE
rotation q = llEuler2Rot(  <90,20,0>*DEG_TO_RAD );


Like I say, I'm not an expert...