Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with rotation?

Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
11-03-2008 10:49
Hello. I have to rotate an object from <0,315,270> to <0,315,90> and back again. I used this to calc rotation:

CODE

vector eul = <0,0,180>; //180 degrees around the z-axis, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion


Result is <0.0, 0.0, 1.0, -0.0>

But when I use this rotation (llSetRot=llGetRot()+quat) I get a very different rotation. What's wrong with my logic??
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
11-03-2008 12:06
From: Lennard Lopez
But when I use this rotation (llSetRot=llGetRot()+quat) I get a very different rotation. What's wrong with my logic??

It really never makes sense to ADD quaternions. Try multiplying instead. More like 'llGetRot()*quat'.
Lennard Lopez
Registered User
Join date: 9 Oct 2007
Posts: 52
11-03-2008 12:17
Why didn't I think of that!!! Yes it's working now! Thank you.