Talk:LlSitTarget

From Second Life Wiki
Revision as of 23:27, 2 September 2007 by Strife Onizuka (talk | contribs)
Jump to navigation Jump to search

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