“LlGetBoundingBox”的版本间的差异
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: list llGetBoundingBox( key object ) |参数= 参数:key…”) |
|||
| 第4行: | 第4行: | ||
{{函数详情 | {{函数详情 | ||
|函数名 = Function: list llGetBoundingBox( key object ) | |函数名 = Function: list llGetBoundingBox( key object ) | ||
| − | |参数= 参数:key object | + | |参数= 参数:key object –同一区域组、化身或者物品的UUID |
|返回值= 返回值:以局部坐标返回一个列表,该列表是对象相对于其根prim的边界框。 | |返回值= 返回值:以局部坐标返回一个列表,该列表是对象相对于其根prim的边界框。 | ||
2021年8月29日 (日) 02:41的版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: list llGetBoundingBox( key object ) |
| 参数:key object –同一区域组、化身或者物品的UUID |
| 返回值:以局部坐标返回一个列表,该列表是对象相对于其根prim的边界框。 |
| 注意事项 |
|---|
注意事项
|
| 示例 |
|---|
default//An avatar bounding box ruler thingy
{
state_entry()
{
llSetStatus(STATUS_PHANTOM, TRUE);
}
touch_start(integer total_number)
{
key target = llDetectedKey(0);
list box = llGetBoundingBox(target);
vector center = llDetectedPos(0) + (llList2Vector(box, 0) + llList2Vector(box, 1)) * 0.5;
vector size = llList2Vector(box, 1) - llList2Vector(box, 0);
llSetPrimitiveParams([PRIM_POSITION, center, PRIM_SIZE, size]);
llSetText("Name: " + llDetectedName(0) + ", UUID: " + (string)target +
"\nBounding Box Size: " + (string)size, <1.0, 1.0, 1.0>, 1.0);
}
}
// Enclose a named object in the tightest possible box
// that is aligned with the object's root prim axes.
// Drop this script in a box near the object to enclose
// (must be in a 10m range)
string ObjectNameToEnclose = "SearchMe";
key UUID;
default
{
state_entry()
{
llSensor(ObjectNameToEnclose, "", ACTIVE | PASSIVE, 10, PI);
}
sensor(integer n)
{
UUID = llDetectedKey(0);
llSetTimerEvent(1);
}
timer()
{
list info = llGetObjectDetails(UUID, [OBJECT_POS, OBJECT_ROT]) + llGetBoundingBox(UUID);
vector pos = llList2Vector(info, 0);
rotation rot = llList2Rot(info, 1);
vector corner1 = llList2Vector(info, 2) * rot + pos;
vector corner2 = llList2Vector(info, 3) * rot + pos;
vector size = llList2Vector(info, 3) - llList2Vector(info, 2);
llSetPos((corner1 + corner2) * 0.5); // Set position to the midpoint (average) of the corners
llSetRot(rot);
llSetScale(size);
}
}
|
| 相关函数 |
|---|
| llGetAgentSize |
| 相关事件 |
|---|