Difference between revisions of "Talk:LlGetBoundingBox"

From Second Life Wiki
Jump to navigation Jump to search
Line 15: Line 15:
Hello Strife (and others who read this), could you add this function that I made today together with Chieron Tenk upon a request in an in-world scripter-group to the llGetBoundingBox page as an example, please:
Hello Strife (and others who read this), could you add this function that I made today together with Chieron Tenk upon a request in an in-world scripter-group to the llGetBoundingBox page as an example, please:


//isInPrim - determines whether a given vector position in the region is within the borders of a cuboid, respecting the cuboid's rotation.
<lsl>
<nowiki>integer isInPrim(vector vPos)
//(bool) isInPrim - determines whether a given vector position in the region is within the borders of a cuboid, respecting the cuboid's rotation.
integer isInPrim(vector vPos)
{
{
         vector v1 = llGetPos() + llList2Vector(llGetBoundingBox(llGetKey()),0);
         vector v1 = llGetPos() + llList2Vector(llGetBoundingBox(llGetKey()),0);
Line 66: Line 67:
         }
         }
         return TRUE;
         return TRUE;
}</nowiki>
}</lsl>
tyvm
tyvm
--[[User:MartinRJ Fayray|MartinRJ Fayray]] 18:09, 15 January 2013 (PST)
--[[User:MartinRJ Fayray|MartinRJ Fayray]] 18:09, 15 January 2013 (PST)

Revision as of 18:11, 15 January 2013

I did some tests for a reliable "avatar out of sim" check, trying to find a way around the usual cache time on things like llKey2Name. llGetBoundingBox reports an empty list if the avatar is out of cache (as expected and described on LSL Wiki). But surprisingly, it reports <-0.100000, -0.100000, -0.100000> <0.100000, 0.100000, 0.100000> for an avatar out of sim, but still within the usual cache period. Is this "official", reliable behaviour? --Tali Rosca 23:08, 4 February 2009 (UTC)

"The bounding box of an avatar sitting on an object includes that object."

They were talking about changing this (saw it somewhere on jira... or maybe I misread that jira). -- Strife (talk|contribs) 04:07, 26 January 2010 (UTC)

Hi, yes, I filed SVC-5276 for confirmation. Falcon changed it that way on purpose, attachments get new boxes and avatars keep the old ones. --Cerise Sorbet 04:47, 26 January 2010 (UTC)

History & SVC-1174

Note to self (or anyone else) need to put info about functionality before 1.36 in history section (Don't have time now). -- Strife (talk|contribs) 19:22, 25 February 2010 (UTC)

isInPrim

Hello Strife (and others who read this), could you add this function that I made today together with Chieron Tenk upon a request in an in-world scripter-group to the llGetBoundingBox page as an example, please:

<lsl> //(bool) isInPrim - determines whether a given vector position in the region is within the borders of a cuboid, respecting the cuboid's rotation. integer isInPrim(vector vPos) {

       vector v1 = llGetPos() + llList2Vector(llGetBoundingBox(llGetKey()),0);
       vector v2 = llGetPos() + llList2Vector(llGetBoundingBox(llGetKey()),1);
       vPos = llGetPos() - vPos;
       vPos = llGetPos() + vPos / llGetRot();
       float fTemp;
       if (v1.x > v2.x)
       {
           fTemp = v2.x;
           v2.x = v1.x;
           v1.x = fTemp;
       }
       if (v1.y > v2.y)
       {
           fTemp = v2.y;
           v2.y = v1.y;
           v1.y = fTemp;
       }
       if (v1.z > v2.z)
       {
           fTemp = v2.z;
           v2.z = v1.z;
           v1.z = fTemp;
       }
       if (vPos.x < v1.x)
       {
           return FALSE;
       }
       if (vPos.y < v1.y)
       {
           return FALSE;
       }
       if (vPos.z < v1.z)
       {
           return FALSE;
       }
       if (vPos.x > v2.x)
       {
           return FALSE;
       }
       if (vPos.y > v2.y)
       {
           return FALSE;
       }
       if (vPos.z > v2.z)
       {
           return FALSE;
       }
       return TRUE;

}</lsl> tyvm --MartinRJ Fayray 18:09, 15 January 2013 (PST)