Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Vector to rotation

Rael Delcon
Registered User
Join date: 23 Nov 2006
Posts: 86
05-13-2009 14:33
Sorry if it's a dupe, I can't seem to find the answer in the forum.

Let's say I have point represented with the vector <a,b,c>. This also represent a rotation of this vector from the axis x to that position (where the vector would have been a zero rotation <0,0,0,1>;).

If I'm not mistaken, I could calculate that rotation using:

rz = llAtan2(a,b);
ry = llAtan2(b,c);
rx = llAtan2(c,a);
r = llEuler2Rot(<rx,ry,rz>;);

but I'm wondering if thre's any other simpler method that would avoid using 3 trigonometric functions.

Any idea?

Thanks
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
05-13-2009 14:50
From: Rael Delcon
Sorry if it's a dupe, I can't seem to find the answer in the forum.

Let's say I have point represented with the vector <a,b,c>. This also represent a rotation of this vector from the axis x to that position (where the vector would have been a zero rotation <0,0,0,1>;).
llRotBetween(<1,0,0>,<a,b,c>;) unless I'm being more than usually stupid (which is certainly possible).
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Rael Delcon
Registered User
Join date: 23 Nov 2006
Posts: 86
05-13-2009 15:20
Thanks Argent. I completely missed that function!!