Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
12-29-2005 00:13
How do I rotate an individual prim in an object to point toward a given (normal) directional vector? I've seen no library function that allows for a vector-to-quaternion (or even vector-to-euler) conversion, which probably means that it's a simple mathematical thing that I'm not seeing. I just need the Z axis of a given nonphysical prim to point in the (vector) direction given without dragging the prims it's linked to along with it.
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
12-29-2005 01:51
|
Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
12-29-2005 11:35
I did. That was the problem. llLookAt works on the entire object, but can't be used on individual prims.
EDIT: Saw the example script that compares the rotational and vector forms and the equivalent conversions. Will try llSetLocalRot with that.
|
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
|
12-29-2005 12:05
This should work in a child prim. Don't use it in the root prim. ChildLookAt(vector pointat) { llSetLocalRot(llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(pointat - llGetPos())) / llGetLocalRot()); }
This may also work and if it does, is simpler. ChildLookAt(vector pointat) { llSetRot(llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(pointat - llGetPos()))); }
These all assume the vector you're telling it to look at is some point in the world. For instance if you pass it the detected position of something, it will look at that something. They also assume your pointer should point it's X axis at the something.
|