Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Problem with Avatars, Collisions, and Sitting

Roburt Musketeer
Registered User
Join date: 31 Oct 2005
Posts: 17
01-27-2006 10:01
Okay, I'm having a bit of a problem that I'm hoping someone might be able to help me with. Without going into a geat deal of pointless detail, I am working on building an elevator. The user(s) will sit on it, physics will be enabled, and off it will go. No problems so far. But the elevator is designed in such a way that it does not full enclose the passengers.

Now, since it's physics enabled, if the elevator should happen to hit an obstruction on it's way to it's target it will bounce off and fly away wildly. Obviously a bit of a problem. I've added code to stop it if it collides with anything, and to set it back on the right path.

The tricky part is, it doesn't seem to detect collisions to the AVATARS riding on it. If the avatar riding the elevator hits an obstruction, but the elevator itself, the prims that comprise it, don't hit it.. the collision event isn't called, and the elevator spins off into space.

So, my question is... Is there a way to make an object notice collisions that occur to an avatar sitting on it? Or am I going to have to do something a bit clunky with a timer and some code to see if the elevator is where it should be every few seconds?
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-27-2006 10:27
Roburt,

You could try putting a phantom, transparent prim around or on the top and bottom of the elevator so that it will detect anything above or below the Avatars.
If you set it to phantom using llSetVolume (I don't remember the name exactly) the prim will still detect collisions while it is phantom.
I believe you can even add a collision filter to catch prims and AVs or just prims.
Roburt Musketeer
Registered User
Join date: 31 Oct 2005
Posts: 17
01-27-2006 10:54
I considered that... But there are a few problems. First off, you can't just set certain prims in a linkset transparent, and the others solid... Can you? I could be wrong there I suppose...

The other problem is that, being a phsyical object, my elevator is very mass sensitive. I can't make it too large, or it won't be able to float or fly. As such the main components of the elevator are small and at the center of the object. I can't add large, massive prims above and below it, and I can't use very small prims, because they'll be too far away from the center of the linkset, and won't link properly

At the moment I'm just working out some code with a timer to check it's status regularly. Wasteful and inellegant, but it should work...
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-27-2006 11:11
You should be able to set any prim transparent in the link set. Just put the script in the prim that you want transparent and have it set the alpha on rez or something.

How large is the elevator? I have an object that is about 15 prims total at 12m high, 10m wide and it floats just fine with physics.
You wouldn't need much for detecting the collisions. Just 2 thin prims the same width and depth as the elevator. One below and one above.
That shouldn't add much weight if the elevator isn't huge.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
01-27-2006 11:11
What happens if you set the elevator to be phantom right before it starts moving? I wonder if it will still get knocked around if an av sitting on the elevator collides. And you could maybe add a large hollowed invisible prim without changing the mass too much. Though if you have a prim enclosing the av and the elevator is phantom, maybe the av will collide anyway. No t sure... haven't played with the physics engine enough to know what will happen here. Good luck :)
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
01-27-2006 11:39
If the avatars are sitting on it, why are you using physical motion below 768 meters?

Non-physical motion can go up to 50 meters a second, and can't collide with anything.

Scripted physical motion can go faster than that, but it seems like you're asking for trouble doing high-speed automated physical motion within the building limit, and over the building limit the chance of collision is negligable... the only things up there are planes and avatars.
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
01-27-2006 11:58
first set llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); in there somehwere. That will keep it from spinning. Second, have a last position variable checked and set on each itteration. If you haven't moved a significant distance assume you're stuck. Alternatively use non physical movement since the avatars are sitting and don't need to be pushed along by the elevator :).
_____________________
Roburt Musketeer
Registered User
Join date: 31 Oct 2005
Posts: 17
01-27-2006 14:28
Damien Took> Oops! Sorry! I meant PHANTOM! you can't just set some prims in an object phantom.. It's all or nothing I believe.

Ziggy Puff> I've tried that. The object you're in/on bcomes pahntom.. But the avatar doesn't. The avatar will still cause collisions then. :)

Argent Stonecutter> Ah, but who says it's only working below 768m? :) I want this to go much higher, pretty much to the sim's ceiling around 4000m. I COULD use non-physical motion below that height, but there'ss till the possibility of collisions with stuff above that level, slight though they may be.

Rickard Roentgen> Hmmmm... Good idea with setitng the object so it CAN'T rotate... I didn'te ven think of that. :)


In the end though, I simply added a timer that checks every few seconds to see if the object has been rotated off it's original axis. Just about any collision is going to bounce it around, so it should pick up on it either through collision_start, or the timer.

Actually, I've designed it so that if it DOES hit something, it stops... moves in a random direction for a few seconds to (hopefully) clar the obstacle.. and then continues towards it's destination. This is really only going to be used to ge straight up over a piece of property I own, and there shouldn't be anything for it to collide WITH... But since it's going to be part of a service I plan to charge for eventually, I want to make sure it's as foolproof as possible. :)
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-27-2006 14:36
Actually, you can set some to phantom.
If they are phantom before they link then they will stay that way while the root prim is still solid.
But your way is much less complicated and should work just fine.

Like they always say "Keep it simple!" :D
Rickard Roentgen
Renaissance Punk
Join date: 4 Apr 2004
Posts: 1,869
01-27-2006 14:39
oh? really? how persistant is it? if I cross into another sim will it become unphantom?
_____________________
Damien Took
Meat Popsicle
Join date: 3 Dec 2004
Posts: 151
01-27-2006 14:51
Ya know I haven't tried crossing in to another sim with it yet.
I would assume it would be stable though.
I think I have seen it on other object before.
I made a large ship and wanted to add physics to it. I was too heavy to hover so I added four sphere prims set to transparent and phantom, linked them to the ship and it worked.
The ship was solid and the spheres stayed phantom.
But I never left the sim so I don't know beyond that.