How to get an Av to sit at...
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
04-16-2007 10:34
Hi! I need to sit an AV at a distance of the prim containing the script which is half of the AV's height. To get the height of the Av I use llGetAgentSize, the problem is that I declare llSitTarget in the state_entry() and then in a changed event I use llAvatarOnSitTarget to get the AV's key and so getting its height. But this doesn't work. I mean this: vector AVheight; default { state_entry() { llSitTarget(<0.0, 0.0, AVheight.z>, <0,0,rotation.z + (90 * DEG_TO_RAD),1>); } changed(integer change) { if (change & CHANGED_LINK) { key agent = llAvatarOnSitTarget(); AVheight = llGetAgentSize(agent)/2; } } } This doesn't work I know but how can I get the llSitTarget to know the z value of the vector? If I declare the llSitTarget in the changed event it doesn't work... I don't want to use touch_start or a sensor Thanks.
_____________________
First goes before AW Devices
|
|
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
|
04-16-2007 11:01
Well, I haven't had to be picky about sit targets to the point of needing to change them constantly, but your's is a difficult problem.
The reason being is that you cannot change a sit target after an AV has already sat down and have it adjust where they are sitting at.
I do, however, believe that you could use the GetAgentSize to llSetLinkPrimitiveParams and move the Prim they're sitting on based off the offset.
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
04-16-2007 11:33
From: Tiarnalalon Sismondi I do, however, believe that you could use the GetAgentSize to llSetLinkPrimitiveParams and move the Prim they're sitting on based off the offset.
this is probably the best work-around I've been able to find. Also, with the new found llSetLinkPrimitiveParameters, you may be able to adjust the avatar's position with this command since it is considered a linked prim when it's sitting on an object.
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
04-16-2007 12:08
Do you mean llSetPrimitiveParams ? and using it like this, after AVheight = llGetAgentSize(agent)/2; llSetPrimitiveParams([PRIM_POSITION, llGetLocalPos() + <0.0, 0.0,AVheight.z >]);
_____________________
First goes before AW Devices
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
04-16-2007 12:35
From: Azul Wilder Do you mean llSetPrimitiveParams ? and using it like this, after AVheight = llGetAgentSize(agent)/2; llSetPrimitiveParams([PRIM_POSITION, llGetLocalPos() + <0.0, 0.0,AVheight.z >]); No there's a new command llSetLinkPrimitiveParams That allows you to adjust the properties of a child prim just like you would with llSetPrimitiveParams. since an avatar sitting on an object is linked to it and considered a child prim by the linkset, llSetLinkPrimitiveParams may be useful for adjusting the position/rotation of the avatar. I do not have acess to SL at this time so I cannot experiment with it to give you definate uses. [edit] You'd have to calculate the link number of the avatar while it's sitting, but I think it's one less than the total number of prims in the link set when the avatar is sitting on it. llSetLinkPrimitiveParams(llGetNumberOfPrims() - 1 , [PRIM_POSITION, llGetLocalPos() + <0.0, 0.0,AVheight.z >])
is the code I'm thinking would apply
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-16-2007 15:12
From: Senuka Harbinger You'd have to calculate the link number of the avatar while it's sitting, but I think it's one less than the total number of prims in the link set when the avatar is sitting on it. The avatar's link number is equal to the total number of prims in the linkset, since the root prim is #1, not #0 (0 being reserved as the link number for a single, unlinked prim).
|
|
Rumbeard Chowderhead
Registered User
Join date: 9 Apr 2006
Posts: 7
|
04-20-2007 08:31
i have resolved this problem in some builds by having the avatar touch the object first. in the touch event use llGetAgentSize(llDetectedKey(0)) to get their size and save it as a vector and reset the sit target to reflect this, then when they sit it is where you want.
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
04-21-2007 00:00
In my case the avatar doesn't touch the prim first.
_____________________
First goes before AW Devices
|