Jump to content

Return physical objects to their original location after being pushed


Mircea Lobo
 Share

You are about to reply to a thread that has been inactive for 3697 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a region (Opensim mind you) on which I plan to add a lot of physical objects... such as crates, trash cans, chairs, or other stuff that can be pushed around. However, I want those objects to re-appear at their original location and rotation after a while, so avatars can't permanently push them god knows where. I've seen this done on another sim, but never accessed the original script myself.

Usually I'm good with LSL. In this case however, there are a few things that get in the way. First of all, how do you know when an object was pushed by an avatar or another physical object? If you simply use the collision_start event, it might also detect the floor as an obstacle, and run the function unnecessarily. Second, llSetPos has a limit of 10 meters... and although I can override it in Opensim I'd rather do things the right way. How would I teleport the object back if it's been puhed more than 10m away, without having to use llSetPos in a loop?

I tried google, but the only term that comes to mind is auto-return... and in SL that addresses parcel auto return, not returning physical objects to their original position a minute after they've been last pushed. Any ideas?

Link to comment
Share on other sites

- store position and rotation on rez and/or on click by owner to define the default position/rotation (llGetPos / llGetRot)

- run a timer

- in timer event compare position and stored position

- if different use llSetRegionPos and llSetRot with the stored position/rotation
you need to make the object non physical, then change position then make physical again

As far as I know opensim has llSetRegionPos too, but I don't know that for sure.

 

Link to comment
Share on other sites

Thanks to the suggestions. Funny I was never aware of llSetRegionPos, but that sounds like it should solve it.

As for comparing position / rotation in a timer event, that can work. But I'd rather have the object detect the last moment when it was pushed by something and set the timer event then. Is it possible for a script to detect if the prim it's in has been pushed by an avatar or another physical object, but ignore collisions with terrain or non-physical prims?

Link to comment
Share on other sites

I wasn't sure if that's possible, but if it is this should totally work. It does also sound like Opensim should have it by now, and llDetectedType is marked as implemented over here so I won't worry.

Of course, there is still a little problem. Suppose I stack multiple crates on top of each other, the function still triggers even if the objects are at their initial position. So I'll probably still need to do some distance comparison, like llVecDist. Otherwise, this should solve the problem... thanks.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3697 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...