Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How do I unsit an avatar gently?

Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
09-08-2008 00:52
I'm working on an alternative elevator for a friend's store whereby the avatar sits on a freestanding non-physics pose ball which then uses multiple iterations of llSetPos to move up through a hole in the ceiling while playing an anim that makes it look as if the avatar is climbing up a prim rope just next to it. On reaching the end of its route it stops moving, stops playing the anim and unsits him.. and this is where I'm having problems.

What's a recommended way of giving him a gentle shove away from the ball when I unsit him? My experiments so far with llPushObject are giving unpredictable results (that is, I don't know enough about what I'm doing to predict the outcome). I don't want to send my friend's customers flying half-way across the room but nor do i want to drop them straight back down the hole from which they've just emerged. Ideally, I'd like to move the customer about 1 metre away from the ball's centre when I stop the anim (the ball's rotation is <0.0, 0.0, 0.0>, if that simplifies matters).

Or is there another way of doing it without using llPushObject? I've thought of moving the poseball away from the rope when I reach the top, unsitting the rider, and then moving back to the rope, and I'm considering llSetLinkPrimitivePos, though I gather that's a bit broken when it comes to moving sitting avatars. Any suggestions?

And, on a possibly related matter, what does vector angular_impulse in llPushObject do? All the examples I've seen have it set to zero and I can't find any discussion of what happens when it isn't.
Awnee Dawner
object returned to sim
Join date: 7 Apr 2008
Posts: 206
09-08-2008 02:22
hey!

llUnSit(key id) is your friend

http://lslwiki.net/lslwiki/wakka.php?wakka=llUnSit
_____________________
>> yes <<
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
09-08-2008 02:28
One method you can use.. is to have the abnimation "considerably offset" from the sit target. Let me give an example. I downloaded the official "sit" animation from the SL website. Then in frame 1, I moved the hips 40.00 in Y (which is more like 1m). Saving that animation and uploading it to SL, when the avatar sits now, the agent (under the nametag) remains offset from the avatar.

When you unsit, the avatar unsits at the position of the agent.

This allows you to put the poseball in a "safe to stand" space (make it phantom)... and lets you "animate" the avatar elsewhere.

It's very hard to explain in words.. I hope I'm doing a fair job of it.

The upshot of this approach, is that you don't need to "push" the agent at all, because it's not where the avatar is. It can look a bit funny in terms of an avatar being offset from it's nametag.. but once you see how much easier it is to get the avatar off it's seat, well in my opinion, I can look past that weirdness.

I made a porta-potty.. as an example. And the agent remains outside the box. The avatar sits, flips around, and offsets so that it's sitting on the commode, but whether the door is open or closed when you unsit, your avatar ends up standing outside the box when you stand. I admit, it's a little strange, seeing my nametag floating in front of the box.. but it works well, and I don't have to worry about some ultra-tall avatar getting stuck inside the box.

Once again, the agent visualizer might be of help.. so I'll include that code here.

CODE


// AGENT Visualizer - By: Winter Ventura
// Permission is granted to fold, spindle, mutilate, slice, dice, and julianne.
// Use them together, Use them in peace.

init()
{
llSetObjectName(llKey2Name(llGetOwner()) + "'s Agent Stand-in");
llSetPrimitiveParams([
PRIM_COLOR, ALL_SIDES, <0,0,0>, .25,
PRIM_PHANTOM, TRUE,
PRIM_TYPE, PRIM_TYPE_SPHERE, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>,
PRIM_TEXTURE, ALL_SIDES, "769681c6-9064-ab0f-e416-6a4eecc59e6a", <1,1,0>, <0,0,0>, 0.00,
25, ALL_SIDES, 0.05 // PRIM_GLOW
]);
llSensorRepeat("", llGetOwner(), AGENT, 96, PI, 0.1);
}

default
{
state_entry()
{
init();
}

on_rez(integer start_param)
{
init();
}

changed (integer change)
{
if (change & CHANGED_OWNER) init();
}

sensor(integer num_detected)
{
llSetPrimitiveParams([
PRIM_POSITION, llDetectedPos(0),
PRIM_ROTATION, llDetectedRot(0),
PRIM_SIZE, llGetAgentSize(llGetOwner())
]);
}
}




Edit:

I just had a thought. Since around the time that they instituted Havok 4, there's been a way to move the agent. I think the trick is to use llSetLinkPrimitiveParams, and PRIM_POSITION, on prim 0 (the agent) ~ someone correct me if I'm wrong on that.

So, in theory, when your person reaches the top of the rope, the script could actually shift their agent's position, and then unsit them. This, of course, wouldn't help them if the chose to "unsit"... But it's another way to approach the issue.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
09-08-2008 05:54
Awnee, thank you so much for your helpful suggestion. I had, in fact, consulted the wiki about llUnsit and had there found the following advice:
From: someone
Q: When I make an avatar stand up from my chair, they end up standing on it. That looks stupid. Is there some way to get them to stand up and move to a specific position?
A: Not precisely. There are a couple things you can try. The most effective option is to apply a small force to the avatar with llPushObject.
That was why I was asking about how much force I should apply, since, in tests, I was either not moving myself or my friend at all or i was sending us flying all over the room.

Winter.. thanks for both suggestions and for the code. You explained very clearly (at least I could understand it, so it must be clear, since I know very little about animation) and I will ask my animator friend to see what she can do with it.

In the meantime, though, I've had a play with llSetLinkPrimitiveParams, and that seems to do exactly what I need, with one slight amendment. According to the wiki, "the link number for a single avatar sitting on the object will always be the primcount of the object", and when I am sitting on the (unlinked) poseball,
CODE
 llStopAnimation(sitAnimation);
llSetAlpha(1.0, ALL_SIDES);
llSetLinkPrimitiveParams(2, [PRIM_POSITION, <1.5,0,0>]);
llUnSit(avatar);
scoots me over to safety before unsitting me. Linknumber 0 doesn't seem to do anything and 1 moves the ball (with me still sitting on it, of course, but the ball ends up in the wrong place). Thanks so much.