Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llLookAt Questions

Oberon Onmura
Registered User
Join date: 28 Dec 2006
Posts: 125
04-20-2009 08:50
In reading through some of the posts here, I'm a little confused about whether llLookAt works or doesn't work with nonphysical objects. I tried it, with a strength variable = 1.0, and it seems to rotate the prim. Beyond that, I don't know. Any final answers on this?

Also, in trying it, I noticed something odd, but my understanding is minimal so it may just be my brainlessness. I have a bunch of objects arrayed around a center point. When I tell them with llLookAt to face the vector of that center point, they all see to face in the same direction rather than looking at the center. Is this a demonstration of the "nonphysical object with llLookAt" problem?

Thanks!
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-20-2009 11:51
look at fails to rotate avatars when used in attachments (which is probaly what you're getting from forum browsing) and depending on factors like size, shape, and strength, it may fail to rotate completely or if strenth is too high, damping may be overwhelmed and it might over rotate, llRotLookAt seems more stable in this capacity (but requires a rotation input instead of a vector)

and although it doesnt say so in the LSL Portal it looks as though it uses an offset and not a region position, which explains why all the objects were looking in a specific direction. to get that effect you'll need to figure out where your target is in relation to each object
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Paladin Pinion
The other one of 10
Join date: 3 Aug 2007
Posts: 191
04-20-2009 12:39
From: Void Singer
depending on factors like size, shape, and strength, it may fail to rotate completely or if strenth is too high, damping may be overwhelmed and it might over rotate


I can testify to this, it drove me nuts for months. I made a tiny little physical fish, set its status to block rotation on the x and y axis, and couldn't figure out why it kept flipping upside down. It took me forever to finally realize I'd set the rotation strength way too high (I don't think that's documented anywhere, it would have saved me some hair.) A strong rotation overpowers everything else, it seems. I had the same experience with a much larger physical object, but since it was my second experiment it only took me a few weeks to remember what I'd done wrong. :)

Slow learner, me.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-20-2009 13:08
llLookAt does work OK with nonphysical objects, but the strength and damping values don't really change anything unless the object is physical. The offset thing in the wiki's example script seems to be an attempt to point the object at the agent's head rather than pelvis, but it does use region coordinates.

The function does go silly in child prims, because it assumes the root is at zero rotation and children will point the wrong way otherwise. It will probably be a lot easier to skip to llSetRot or llSetLocalRot in those cases, so you can apply the necessary adjustments without too much pain.