Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving Seated Avatar using llSetLinkPrimitiveParams

Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
06-25-2009 12:11
Okay.. this is something I've been wracking my brains on. I've done some searching on the forums here, and I guess I'm just not picking the right terms. So I figured it's a good time to ask a question.. which I'm sure has been asked before (sorry in advance).

So here's the story.. I'm a pretty basic scripter. I understand the "logic" style of programming fairly well. If this, then this.. I totally get that. Dynamic menus, transforming linksets.. no sweat. But when it's come to "things you sit on", I've always left the avatar in one place.

Well now I'm looking at building a chair with multiple animations, and I'm considering making use of some 3rd party animations (cause I don't want to be bothered making animations JUST for a chair). But of course these animations all have varying butt-positions, since they were built for different projects.

I know that there's a way to move the llAvatarOnSitTarget, but I've had some difficulty figuring out how to determine which link number belongs to the seated avatar.

While yes, I guess I'm using this forum wrong.. I need to ask, can anyone point me to a simple example script that does this? I'm not looking for someone to write the script for me, but while I know that llSitTarget and llSetLinkPrimitiveParams are used in this.. I just don't know how they're supposed to fit together.

I can manage choosing the sit targets myself.. it's the issue of reliably moving the seated avatar (and moving the correct avatar when someone else unexpectedly sits on it) that's the problem.

Any help or insight you can offer will be greatly appreciated.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-25-2009 12:26
Of course you know Strife's 'UpdateSitTarget' on http://wiki.secondlife.com/wiki/LlSitTarget
_____________________
From Studio Dora
Cheree Bury
ChereeMotion Owner
Join date: 6 Jun 2007
Posts: 666
06-25-2009 12:49
Try this:

llSetLinkPrimitiveParams(llGetObjectPrimCount(llGetKey()) + 1, [PRIM_POSITION, animation_offset] );

where animation_offset is a vector of the amount you want to move the avi.

The sitting avi is always the last prim in the linkset.



I pulled that from this thread I had going a while back:

/54/d7/273176/1.html
_____________________
Visit ChereeMotion - Life's Best Pinup Poses
http://slurl.com/secondlife/Wild%20Rice/38/230/51
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-25-2009 13:34
Iterate over the link number from llGetNumberOfPrims() to 2 (1 is always the root prim and cannot be an avatar) using llGetLinkKey() until you find one that either matches the avatar's key or is not an avatar (tested using a comparison of llGetAgentSize() to ZERO_VECTOR). Seated avatars always come at the end of the link set (though I'm not sure if prims can be linked in when the avatar is seated and what affect that might have on the link order; it's not likely to happen unless designed to do so in any case).
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-25-2009 20:15
From: Hewee Zetkin
(though I'm not sure if prims can be linked in when the avatar is seated and what affect that might have on the link order; it's not likely to happen unless designed to do so in any case).

creating and breaking links both unseat av's.
_____________________
|
| . "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...
| -