Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llLookAt range?

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
06-12-2009 16:28
I'm using a very basic script I found to cause part of an object to look at the nearest avatar. However, I can't seem to get it to only work within a specific range. Can anyone help me spot where in this script I'd have to set that, or if I'd have to use something different?

CODE

default
{
state_entry()
{
llSensorRepeat("", "", AGENT, 20.0, PI, 0.2);
}

sensor(integer total_number)
{
llLookAt( llDetectedPos(0) + <0.0, 0.0, 1.0>, 3.0, 1.0 );
}
}
Nexii Malthus
[Cubitar]Mothership
Join date: 24 Apr 2006
Posts: 400
06-12-2009 16:43
Between "AGENT," and "PI," is the distance of the sensor repeat.

It is set to 20.0 meters currently, a sensor can have a maximum distance of 96.0m. So you set it between 0 and 96 as you please.
_____________________

Geometric Library, for all your 3D maths needs.
https://wiki.secondlife.com/wiki/Geometric

Creator of the Vertical Life Client
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
06-12-2009 16:48
Thanks much.

Now I'm getting tricky... Anyone know how to make this type of thing work on a physical object?
Or, I should say, while linked to a physical object? I've got a base prim that moves around randomly. I'd like to link this prim to it, so that it seems like a "camera" on the moving object is turning to look at anyone it passes.
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-13-2009 00:42
The wiki says it all: http://wiki.secondlife.com/wiki/LlSensorRepeat
_____________________
From Studio Dora
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-13-2009 02:10
be aware that sensor repeat has a bug which picks up out of range objects every few cycles.
_____________________
|
| . "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...
| -