Difference between revisions of "Talk:LlSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
m (Talk:LSL llSitTarget moved to Talk:LlSitTarget: removing prefix)
Line 1: Line 1:
I have a feeling that llSitTarget does not work if someone is already sit on the object.
===Optimization===
The second person to sit will sit in the clicked position rather than the target.
<pre>
 
list GetSitTarget(integer prim, key av)
I wanted to shift the sit target as people sit but it does not look possible.
{//WARNING: llGetObjectDetails can introduce an error that goes as far as the 5th decimal place.
    if(prim == LINK_THIS)//llGetLinkKey doesn't like LINK_THIS
        prim = llGetLinkNumber();
   
    list details = OBJECT_POS + (list)OBJECT_ROT;
    vector tp = llGetAgentSize(av);
    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];
}//Written by Strife Onizuka
</pre>

Revision as of 09:34, 1 September 2007

Optimization

list GetSitTarget(integer prim, key av)
{//WARNING: llGetObjectDetails can introduce an error that goes as far as the 5th decimal place.
    if(prim == LINK_THIS)//llGetLinkKey doesn't like LINK_THIS
        prim = llGetLinkNumber();
    
    list details = OBJECT_POS + (list)OBJECT_ROT;
    vector tp = llGetAgentSize(av);
    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];
}//Written by Strife Onizuka