Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Confine Movement or Die if Object Moves Beyond Point or Parcel

Alvaro Zapatero
O.o
Join date: 7 Jun 2008
Posts: 650
01-20-2009 13:08
I'v got a desert-themed skybox that could really use a tumbleweed or two. I've got a sphere that gets pushed around by the wind, but could someone push me in the right direction?

I'd like to add a script that confines the tumbleweed to the skybox, either by limiting it's movement or by dying if it moves beyond a certain point.

Thanks!
_____________________
O.o
C
Alvaro Zapatero
O.o
Join date: 7 Jun 2008
Posts: 650
01-20-2009 16:55
Further searching revealed...

/54/f4/295426/1.html

I'll follow these leads and see where they take me.
_____________________
O.o
C
Yingzi Xue
Registered User
Join date: 11 Jun 2008
Posts: 144
01-20-2009 18:32
I recently did this with a bull ride script. The only difference is the bull resets to its start position instead of dying. I use a prim to set my boundary. I drop a script in the boundary prim and get its bounding box, then it sends that to my bull so it knows what its boundaries are. If I need a large boundary I use a megaprim to set it. After you get the boundary you no longer need the boundary prim since the bull script knows what the boundary is.

Get boundary script - used in a temporary prim sized as your boundary

From: someone

// Boundary getter script
// Get the boundary from the prim. If I need a large boundary I use a megaprim or a linkset of prims, which are counted as a whole bounding box

list temp_list = llGetBoundingBox(llGetKey());

loc = llGetPos();
min = loc + llList2Vector(temp_list,0);
max = loc + llList2Vector(temp_list,1);


Test boundary script - Used in your moving object to test the known boundary (determined by the above script)
From: someone

// Boundary test using current location of object
// Checks x, y and z
vector current_pos = llGetPos();
if ( current_pos.x >= min.x && current_pos.x <= max.x &&
current_pos.y >= min.y && current_pos.y <= max.y && current_pos.z >= min.z && current_pos.z <= max.z)
{
// Yes, within boundary
}
else
{
// No, outside boundary
}
Django Yifu
Beat Island Gaffer
Join date: 7 May 2007
Posts: 189
01-22-2009 05:27
Sweet. I have been looking for a solution like this for some radio controlled ducks I made a while ago. The difference being I'd like the duck to turn towards the center point and be given a nudge in the right direction when it hits boundary.

Shouldn't be too hard to work that in :-)
_____________________
Tread softly upon the Earth for you walk on my face.