Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

rotations being funny

Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
05-15-2007 13:00
alrighty, please see the attached picture.

here's the script for spawning the red, blue, and green bits
CODE

llRezObject("red 2", llGetPos() + <-0.0, -0.0, -0.0>, ZERO_VECTOR, llGetRot() + <0,0,0,0>, 0);

llRezObject("blue 2", llGetPos() + <-0.0, -0.0, -0.0>, ZERO_VECTOR, llGetRot() + quat2, 0);

llRezObject("green 2", llGetPos() + <-0.0, -0.0, -0.0>, ZERO_VECTOR, llGetRot() + quat, 0);





CODE

vector eul; //x degrees around the z-axis, in Euler form
vector eul2;
rotation quat;
rotation quat2;
//other irrelivant code in here

eul = <0,0,90> * DEG_TO_RAD;
quat = llEuler2Rot(eul);
eul2 = <0,0,180> * DEG_TO_RAD;
quat2 = llEuler2Rot(eul2);


I am certain the second block of code is being called.

green is spawned at 90degrees as you can see.

but the blue screen is certainly NOT 90degrees more rotated. (it should be at 180 as you can see). setting all the angle offsets to 0 spawns them all in the same place, so it's not that...

what on earth is screwing with my angles? they're not altered or even referenced anywhere else in the script....
(eventually when I get the angles right, they will all line up with the bottom most brick looking thingy)
mucho thanks for reading :)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-15-2007 15:46
I don't think that you can get a good result by adding rotation each other. Use multiplying.
_____________________
:) Seagel Neville :)
Ged Larsen
thwarted by quaternions
Join date: 4 Dec 2006
Posts: 294
05-15-2007 15:55
From: Dominguez Brentano
alrighty, please see the attached picture.

here's the script for spawning the red, blue, and green bits
CODE

llRezObject("red 2", llGetPos() + <-0.0, -0.0, -0.0>, ZERO_VECTOR, llGetRot() + <0,0,0,0>, 0);



And when you DO multiply the rotations (instead of adding them), be aware that <0,0,0,0> is NOT the ZERO_ROTATION.
_____________________
- LoopRez, flexi prim skirt generating tool
- LinkRez, a necklace chain generator
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
05-15-2007 16:12
thanks for the tips guys. I've not had any problems using llGetRot() + someconstant with in the other things I've built... it's a very odd!


does adding <a, b, c, d> + <e, f, g, h> not work well in SL then?


edit: changed the + for a * and it works now :) thanks guys!

still not sure quite why though :p
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-15-2007 16:22
Because Quadernions are weird!
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
05-15-2007 16:37
From: Milambus Oh
Because Quadernions are weird!



:D I had thought that might be the case!
Ged Larsen
thwarted by quaternions
Join date: 4 Dec 2006
Posts: 294
05-15-2007 16:44
I'm sure you already have, but if not, be sure to read the Wiki page on rotations / quaternions: http://www.lslwiki.net/lslwiki/wakka.php?wakka=rotation

I've read that page over and over, for months now. It's finally starting to sink in.

Pay special attention to the part that talks about the ORDER of quaternion multiplication, which results in apparent rotations based on WORLD vs. LOCAL axes. That can be very helpful.
_____________________
- LoopRez, flexi prim skirt generating tool
- LinkRez, a necklace chain generator
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
05-15-2007 18:14
To combine rotations you have to multiply them (or divide). If you add them it just combines the fields, not calculate the combined rotation.

You may also want to use llRezAtRoot instead.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Dominguez Brentano
Registered User
Join date: 20 Apr 2006
Posts: 87
05-15-2007 18:37
From: Ged Larsen
http://www.lslwiki.net/lslwiki/wakka.php?wakka=rotation

I've read that page over and over, for months now. It's finally starting to sink in.


thanks for that, I'll have to give it a look over again when I get confused! seems like a mighty odd way to do things though... perhaps it's standard practice in 3D graphics, but I'd not heard that it was!

also, I've used llRezAtRoot for some of the other bits, but the the parent of the rez object isn't in a helpful place for this one :)

's all working and in position now :)