Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Spinning following linked objects

Beigeman Teardrop
Registered User
Join date: 13 Aug 2008
Posts: 7
08-27-2008 15:36
I am trying to have a a group of rotating non physical objects follow an avatars movement using the following script derived from the follower scripts:

vector offset = < 0, 0, 1>; //1 meter behind and 1 meter above owner's center.

default
{
state_entry()
{
// Look for owner within 20 metres in 360 degree arc every 1 seconds.
llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0);
llTargetOmega(<0.2,0.2,0.2>,PI,1.0);

}
sensor(integer total_number)
{ // Owner detected...
// Get position
vector pos = llDetectedPos(0);
// Offset up one metre in Z based on world coordinates.
vector worldOffset = offset;
llSetPos (pos + offset);
}
}

I am experienceing quite a lag in the prim keeping up with the avatar can anyone help me with this.

Thanks
Beigeman Teardrop
Registered User
Join date: 13 Aug 2008
Posts: 7
ah just saw that
08-27-2008 15:48
Of course i didn't think to alter the time for the sensor repeat, set it to 0.001 which works a lot better but still gives me a choppy movement in relation to the avatar movement and i beleave it may be prone to lag.

Is there another route i could take instead of using the senserrepeat , i only want the prims to follow the object owner

Cheers
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-29-2008 14:29
You can use llGetObjectDetails() (which is a very good idea if you know the key of the avatar or object you are looking for actually), but the choppiness is in all likelihood coming from the non-physical movement functions, not the behavior of the sensor. The minimum period between sensor events is 0.05. The script delay caused by llSetPos() is 0.2 seconds. The latter delays the script in the event handler, so if you're calling llSetPos() inside your sensor handler, you won't get an event faster than once every 0.2 seconds. Non-physical movement also shows up as instantaneous or nearly so (the client used to do a very fast interpolation between positions; not sure now).

You might be better off making the object physical and phantom, and using something like llMoveToTarget() (but be careful to clip the distance of the target point to less than 50m or so, because if it is too far off, llMoveToTarget() will simply do nothing--unlike non-physical movement which will move the object 10m per call).