Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotations oh lorg plz send hlep.

Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
05-21-2006 22:08
I'm trying to design something that rezzes a projectile.

I want the projectile to rez pointing with the correct orientation toward a target..

This orientation is independent of the camera or the rezzer object's rotation, it depends only on the vector that points from the rezzer object toward the target. I do not want to (nor can I due to STATUS_ROTATE restrictions) use llLookAt for this situation..

Everything input I've tried using for the rotation in the llRezObject call has failed to orient the projectile correctly. Anyone who knows a little more about rotations have some suggestions?
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
05-22-2006 01:14
Try llRotBetween(<0,0,1>, llVecNorm(my_vector));
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
05-22-2006 01:21
CODE

// Pointing the up axis towards a target
vector dir = llVecNorm(targetPos - llGetPos());
rotation rot = llRotBetween(<0.0, 0.0, 1.0>, dir);

You can use that rotation in an llRezObject call, or with llSetRot. If you want to point a different axis at the target, you can use a different vector in the llRotBetween, e.g. <1.0, 0.0, 0.0> for the forward axis.
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
05-22-2006 03:17
I'm not sure why I've never noticed the nature of llRotBetween..

You're lifesavers, thanks!