|
Jim Helfer
Registered User
Join date: 15 Sep 2008
Posts: 9
|
09-15-2008 10:09
I got this script off the wiki. It makes a prim or object follow an avatar. How can one make it follow a prim. So if you move one object the prim will follow it with accuracy. I have seen this done in a swimming pool where if you move the pool the water follows and aligns correctly. Any help would be greatly appreciated. // vector offset = < -1, 0, 1>; //1 meter behind and 1 meter above owner's center. default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); // Little pause to allow server to make potentially large linked object physical. llSleep(0.1); // Look for owner within 20 metres in 360 degree arc every 1 seconds. llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0); } sensor(integer total_number) { // Owner detected... // Get position and rotation vector pos = llDetectedPos(0); rotation rot = llDetectedRot(0); // Offset back one metre in X and up one metre in Z based on world coordinates. // use whatever offset you want. vector worldOffset = offset; // Offset relative to owner needs a quaternion. vector avOffset = offset * rot; pos += avOffset; // use the one you want, world or relative to AV. llMoveToTarget(pos,0.4); } } //[END CODE]
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
09-15-2008 10:22
I guess this is the line you need to change:
llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0);
Find out the UUID of the object you want to follow, and put it in there instead of llGetOwner(). You'll also want to change the object type being scanned to SCRIPTED. That line should then look something like this:
llSensorRepeat("", (key)"00000000-0000-0000-0000-000000000000", SCRIPTED, 20.0, PI,1.0);
Alternatively, if you don't know the UUID of the object, but it does have a fairly unique name (i.e. that won't be confused with any other objects, then you could do it like this (replace "object-name" with the name of the object to follow):
llSensorRepeat("object-name", NULL_KEY, SCRIPTED, 20.0, PI,1.0);
|
|
Jim Helfer
Registered User
Join date: 15 Sep 2008
Posts: 9
|
Thank you
09-15-2008 11:51
Thanks Pedro, I got it working kind of.. it is a start and I appreciate your help. I am not the sharpest tool in the shed. It was not working and then I thought.. hmm he said change the type to scripted.... the object I want followed probably needs a script  as I was just moving it manually through edit. Thanks again for the help.. I will try to work on this more so I can get accurate alignment.
|
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
09-15-2008 13:12
No worries.
You can combine types too. For example, if your object might be passive or might be scripted, then you can use "PASSIVE | SCRIPTED" to scan for both types.
|
|
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
|
09-15-2008 13:43
you'll also need to remove the offset. otherwise it won't be aligned correctly. and you can script the pool so that it rezzes the water on whatever command you want, be it touch, chat. and then you can script the water so that it dies on the same kind of command.
|