Don't click here unless you want to be banned.

LSL Wiki : llRotLookAt

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl427.us.archive.org
llRotLookAt(rotation target, float strength, float damping);

Rotates the object that contains the script (aligns forward/x-axis to camera) to target over damping seconds.

This function works for both physical and non-physical objects. For non-physical objects, good strength values are around half the mass of the object and good damping values are less than 1/10th of the strength. For physical objects, this function behaves more like llMoveToTarget, where increasing the strength or tau seems to slow the rotation. Good values for physical objects range between .2 and 1 for both parameters. Asymmetrical shapes require smaller damping.

Q: Are those recommendations for non-physical objects valid? Or is it that any values in there work when it's essentially weightless?
A: Obviously any value would work for a non-physical object because there's no friction or gravity to worry about. It's whether or not it looks good that you have to think about when choosing the values.

Calling llStopLookAt stops the effects of this function.
Failure to stop may render a prim unlinkable until llStopLookAt is called (even if the script is removed).

Note: within the LSL editor, the tooltip for llRotLookAt reads "llRotLookAt(rotation target, F32 strength, F32 damping)". F32 refers to a 32-bit float. In LSL, all floats are 32-bit.

Compare with llLookAt.


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Dynamics | Rotation
Comments [Hide comments/form]
Has anyone ever experimented and actually checked the damping/strength recommendations?
-- ChristopherOmega (2004-03-09 20:57:58)
How can I get something to always stay level (x and y axes) but letting it rotate any direction on vertical/up/z axis?
-- EepQuirk (2005-09-25 16:43:33)
*twitch twitch*
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
-- BlindWanderer (2005-09-25 18:52:52)
or you could turn it into a vehicle and use vertical attraction.
-- BlindWanderer (2005-09-25 20:43:41)
I found the easiest way to do this was to convert the rotation into euler, and zero-out the X and Y components.
-- ChristopherOmega (2005-09-25 21:47:05)
hmm that works.

I think this will work too.
rotation zero_xy(rotation a)
{
    a.s = llSqrt(a.x * a.x + a.y * a.y + a.s * a.s);//if you knew it were a normal rotation you could replace this with a.s = llSqrt(1 - a.z * a.z);
    a.x = a.y = 0.0;
    return a;
}
-- BlindWanderer (2005-09-25 23:17:29)
I mean using llRotLookAt...
-- EepQuirk (2005-09-27 03:44:43)
Ergo the fragment of code just above your clarification that BW posted. I believe llRotLookAt(zero_xy(llGetRot()),<strength>,<damping>) is the intended use of the zero_xy function posted above.
-- WolfWings (2005-09-27 05:07:47)
sorry was very tired when i wrote that little function, it doesn't work properly
-- BlindWanderer (2005-09-27 13:11:47)
It doesn't work (either method). The object still remains in a fixed position on all axes. I want to make something stay horizontal but rotate on the vertical axis freely.
-- EepQuirk (2006-02-13 02:50:26)
Here's my "fun and easy" way :)
// axisKeep is a "boolean vector", it should have 1 for the
// axies you want to keep, 0 for the axes you want to drop.
// to keep only the rotation along the y-axis, you'd pass <0, 1, 0>
rotation zeroAxis(rotation rot, vector axisKeep) {
    vector euler = llRot2Euler(rot);
    return llEuler2Rot(<euler.x * axisKeep.x, euler.y * axisKeep.y, euler.z * axisKeep.z>);
}
Cheap, I know, and it probably screws fancy mathematical things up, but this is the only way I know how to do it (and Im pretty sure it works).
-- ChristopherOmega (2006-02-13 07:22:05)
Doesn't work either; tried passing llGetRot() and <-.70711,0,0,.70711> as rot, and <0,1,0> for axisKeep (and other single axes and even 2 axes) but zeroAxis() still keeps all 3 axes.
-- EepQuirk (2006-02-13 17:26:29)
Thought, why not use the vehical functions? There is a vehical flag for keeping things level.
-- BlindWanderer (2006-02-14 02:56:51)
I don't want it to be a vehicle. Why is it so hard??
-- EepQuirk (2006-02-16 13:24:53)
I notice that llLookAt does the desired effect you want by default Eep, llRotLookAt allows a lot of "drift" on axis, while llLookAt is very good at minimizing drift. The only downside is, of course, that it treats the vertical axis as "forward."
-- KokiriSaarinen (2006-07-01 03:16:42)
llLookAt doesn't work either.
-- EepTwin (2006-07-12 03:09:59)
Repaired the monospacing.
-- DolusNaumova (2006-07-14 06:07:04)
I'm looking for the same thing EepTwin is, and I've yet to find it. There has to be a way.
the llSetStatus doesn't work, it seems.
-- EagleBird (2006-08-11 12:22:04)
How do you get this to work with physical objects? I had to change the status of object to non-physical to get this to work, and then switch it back to move it.
-- pool-71-255-144-61.cncdnh.east.verizon.net (2007-08-13 06:20:46)
Removed llSetLocalRot working on attachment questions as it appears to be non-sequitor ~Redux
-- cpe-76-171-61-100.socal.res.rr.com (2007-10-08 17:36:45)
Does this on avatars that are sitting on phys/non-phys objects?
-- 160.227.25.34 (2007-11-20 17:08:59)
Attach a comment to this page: