Difference between revisions of "Talk:LlSitTarget"
m |
(Using llSetLinkPrimitiveParams for skydiving: why limited to 5m in a linked set?) |
||
Line 27: | Line 27: | ||
return []; | return []; | ||
}//Written by Strife Onizuka | }//Written by Strife Onizuka | ||
</pre> | |||
==Using llSetLinkPrimitiveParams for skydiving: why limited to 5m in a linked set?== | |||
llSetLinkPrimitiveParams can be used as a handy tool to adjust an avatar's position and rotation. | |||
This works perfectly when the object consists of 1 prim, with a range for setting the avatar position away to 500m easily! | |||
When there are more prims linked, this offset seems to be limited to 5m (measured with llVecDist). This is an awfull sideeffect! | |||
Put this next script inside a prim and sit on the prim, it will bring you to 1000.0 higher then the prim. | |||
Next link this prim to another prim and try again. You will notice you are limited to 5m. My Question: why is this limited? | |||
<pre> | |||
// by Randur Source | |||
integer heightcnt = 0; | |||
list heights = [0.0, 1.0, 5.0, 6.0, 10.0, 100.0, 300.0, 500.0, 800.0, 1000.0]; | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llSitTarget(ZERO_VECTOR,ZERO_ROTATION); // Clear the current sittarget for a clear test | |||
llSetRot(ZERO_ROTATION); // set the prim to no rotation, for simple z axis movement | |||
} | |||
changed(integer change) | |||
{ | |||
if (change & CHANGED_LINK) // detect linked prims and avatars | |||
{ | |||
integer primnum = llGetNumberOfPrims(); // the avatar is the last linked prim | |||
if (primnum <= 1) // stop if there is only 1 prim | |||
return; | |||
key avatar = llGetLinkKey(primnum); | |||
if (llGetAgentSize(avatar) == ZERO_VECTOR) // stop if this is not an avatar | |||
return; | |||
// loop through the list of test heights: | |||
for (heightcnt = 0; heightcnt < llGetListLength(heights); heightcnt++) | |||
{ | |||
float height = llList2Float(heights,heightcnt); | |||
llSetLinkPrimitiveParams(primnum,[PRIM_POSITION,<0.0,0.0,height>]); // set this to the wanted height using a vector z axis | |||
vector avatarpos = llList2Vector(llGetObjectDetails(avatar,[OBJECT_POS]),0); // detect the avatar position within the sim | |||
float distance = llVecDist(llGetPos(),avatarpos); | |||
llOwnerSay("Attempt to move " + llKey2Name(llGetLinkKey(primnum)) + " to " + (string)height + "m high resulting to " + (string)distance + "m"); | |||
llSleep(1.0); | |||
} | |||
llUnSit(avatar); | |||
} | |||
} | |||
} | |||
</pre> | </pre> |
Revision as of 05:45, 1 August 2008
Unsitting on wrong side or camera rotation
Hi, i am getting frustrated with this. I create a board and set the sit target with
llSitTarget(<0.4, 0.0, 0.0>, ZERO_ROTATION);
and an animation which for "standing". So while the person technical sits, she stands in front of the board. But I have a problem with that: If the board stand freely, the person unsits right through it towards the other side. I can put the board with the back facing a large wall. In the case the unsitting is correctly in front of it. But on sit down the camera rotates, so that it is behind the avatar again; on the other side of the wall.
If anyone has an idea how to fix, please tell me (even if it is just an idea where to look for more information). --Maike Short 12:41, 24 February 2008 (PST)
- You could position the camera with the Camera functions. -- Strife Onizuka 04:46, 25 February 2008 (PST)
Optimization
list GetSitTarget(integer prim, key av) {//WARNING: llGetObjectDetails can introduce an error that goes as far as the 5th decimal place. vector tp = llGetAgentSize(av); if(tp) { if(prim == LINK_THIS)//llGetLinkKey doesn't like LINK_THIS prim = llGetLinkNumber(); list details = OBJECT_POS + (list)OBJECT_ROT; rotation f = llList2Rot(details = (llGetObjectDetails(llGetLinkKey(prim), details) + llGetObjectDetails(av, details)), 1); return [(llRot2Up(f = (llList2Rot(details, 3) / f)) * tp.z * 0.02638) + ((llList2Vector(details, 2) - llList2Vector(details, 0)) / f) - <0.0, 0.0, 0.4>, f]; } return []; }//Written by Strife Onizuka
Using llSetLinkPrimitiveParams for skydiving: why limited to 5m in a linked set?
llSetLinkPrimitiveParams can be used as a handy tool to adjust an avatar's position and rotation. This works perfectly when the object consists of 1 prim, with a range for setting the avatar position away to 500m easily! When there are more prims linked, this offset seems to be limited to 5m (measured with llVecDist). This is an awfull sideeffect!
Put this next script inside a prim and sit on the prim, it will bring you to 1000.0 higher then the prim. Next link this prim to another prim and try again. You will notice you are limited to 5m. My Question: why is this limited?
// by Randur Source integer heightcnt = 0; list heights = [0.0, 1.0, 5.0, 6.0, 10.0, 100.0, 300.0, 500.0, 800.0, 1000.0]; default { state_entry() { llSitTarget(ZERO_VECTOR,ZERO_ROTATION); // Clear the current sittarget for a clear test llSetRot(ZERO_ROTATION); // set the prim to no rotation, for simple z axis movement } changed(integer change) { if (change & CHANGED_LINK) // detect linked prims and avatars { integer primnum = llGetNumberOfPrims(); // the avatar is the last linked prim if (primnum <= 1) // stop if there is only 1 prim return; key avatar = llGetLinkKey(primnum); if (llGetAgentSize(avatar) == ZERO_VECTOR) // stop if this is not an avatar return; // loop through the list of test heights: for (heightcnt = 0; heightcnt < llGetListLength(heights); heightcnt++) { float height = llList2Float(heights,heightcnt); llSetLinkPrimitiveParams(primnum,[PRIM_POSITION,<0.0,0.0,height>]); // set this to the wanted height using a vector z axis vector avatarpos = llList2Vector(llGetObjectDetails(avatar,[OBJECT_POS]),0); // detect the avatar position within the sim float distance = llVecDist(llGetPos(),avatarpos); llOwnerSay("Attempt to move " + llKey2Name(llGetLinkKey(primnum)) + " to " + (string)height + "m high resulting to " + (string)distance + "m"); llSleep(1.0); } llUnSit(avatar); } } }