Barrington John
Yorkshire guy
Join date: 17 Nov 2007
Posts: 119
|
03-07-2008 17:17
Background first. I've got an object which is basically an elevator, a small (by avatar standards) box with an open side for the doors. Inside, there is a basic standing pose (based on the "sit on prim" functionality) so the user can attach themselves to the elevator and hence stay with it while it travels. It's rotated such that the av stands facing the open side.
The trouble is, when they "stand up", the av leaps into the air, going through the ceiling and getting stuck in the elevator shaft. At least they move in the right direction horizontally, since they're facing the opening, but the vertical leap upwards is much too dramatic for this to work.
Is there any way I can prevent or control the leap? This is a show-stopper.
One thing I did try was changing the position with llSitTarget() during the 'changed' event for standing up, moving the target forwards into open space before stopping the animation, but this seems to be run at the start, and gets altered when the av sits on the target in the first place. Here's the code in the 'changed' event - I added the commented line (underscores added to preserve indentation in BBCode):
changed(integer change) { __if (change & CHANGED_LINK) __{ ____if (llAvatarOnSitTarget() != NULL_KEY) ____{ ______llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION); ____} ____else ____{ ______integer perm=llGetPermissions(); ______if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0) ______{ ________llSitTarget(POSITION + <2.0, 0.0, 0.0>, ROTATION); // added to push the av forward ________llStopAnimation(animation); ______} ______animation=""; ____} __} }
|
Crystal Falcon
Registered Silly User
Join date: 9 Aug 2006
Posts: 631
|
03-08-2008 10:16
Can you stand up for them? IE, instead of them clicking the Stand Up button, when the elevator stops, it stands them up so they can simply walk out?  If so, then you can change how much of a push they receive in this (simply click quote this message to maintain the indents and be able to copy/paste): changed(integer change) { if(change & CHANGED_LINK) { key av = llAvatarOnSitTarget(); if(av != NULL_KEY) { llUnSit(av); llPushObject(av,<0,0,2>,ZERO_VECTOR,FALSE); } } } }
Change <0,0,2> to something less, maybe <0,0,0.5>? You do want a little nudge just so they don't get stuck in the floor or something I believe?  I was tired of getting flung around so usually make it much less than the default (that code is from the scripting library).
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-08-2008 12:26
seeing as this is the animation forum, I'll offer an animation solution. ofset your second frame stand pose to be behind the first frame (make take some trial and error to get the distance right) then offset your sit target to be in front of the elevator, so when they get up they are actually already outside of it
another thing that might help is use set link prim parameters to move the av one they sit, based on theier detected pos (a one time sensor for their key when they sit should work) based on the agent size so their feet aren't through the floor (or body inside a prim) which is likely what's causing the ejection effect you're seeing.
NOTE: unsit in the above example won't do anything since when the changed event fires the av is already not sitting, the push will only work if push is enabled for the land or (IIRC) the object has the same ower as the land, and will likely just slam the av into the shaft wall...
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Crystal Falcon
Registered Silly User
Join date: 9 Aug 2006
Posts: 631
|
03-08-2008 14:12
From: Void Singer NOTE: unsit in the above example won't do anything since when the changed event fires the av is already not sitting, the push will only work if push is enabled for the land or (IIRC) the object has the same ower as the land, and will likely just slam the av into the shaft wall... Ahs, that came out of an attachment where it works wonderfully for me everywhere, sorry it can't be used for this! 
|
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
|
03-09-2008 08:39
For a ladder-climbing poseball I made I just moved the ball half a meter forward before unsitting the avatar, then back again. Works nicely and is really simple.
|