Difference between revisions of "Talk:LlSitTarget"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
===Optimization===
==Optimization==
<pre>
<pre>
list GetSitTarget(integer prim, key av)
list GetSitTarget(integer prim, key av)
{//WARNING: llGetObjectDetails can introduce an error that goes as far as the 5th decimal place.
{//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
    vector tp = llGetAgentSize(av);
        prim = llGetLinkNumber();
     if(tp)
    {
        if(prim == LINK_THIS)//llGetLinkKey doesn't like LINK_THIS
            prim = llGetLinkNumber();
      
      
    list details = OBJECT_POS + (list)OBJECT_ROT;
        list details = OBJECT_POS + (list)OBJECT_ROT;
    vector tp = llGetAgentSize(av);
        rotation f = llList2Rot(details = (llGetObjectDetails(llGetLinkKey(prim), details) + llGetObjectDetails(av, details)), 1);
    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 [(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
}//Written by Strife Onizuka
</pre>
</pre>

Revision as of 23:27, 2 September 2007

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