Template:Needs Translation/
函数名
|
Function: vector llDetectedTouchPos( integer index );
|
参数:检测信息索引不支持负索引。
|
返回值:返回在区域坐标中接触对象的矢量位置,除非它附加到HUD,在这种情况下,它在屏幕空间坐标中返回位置。
|
注意事项
|
注意事项
- HUD的附件目前返回坐标相对于屏幕的中心,而不是附着点。svc - 3425
- 如果索引超出界限,脚本将继续执行,不会出现错误消息。
- 当…时返回TOUCH_INVALID_VECTOR
- 头像查看器不支持面部触摸检测。
- 检查是否支持face touch检测,检查llDetectedTouchFace返回。
- 触摸已经离开了表面的prim。
- 触发的事件不是触摸事件。
|
示例
|
示例1
default
{
touch_start(integer num_detected)
{
llWhisper(0, "Pos clicked: " + (string)llDetectedTouchPos(0));
}
}
示例2
vector GetRealTouchPos(vector pos)
{
// By Ariu Arai for free use to anyone
// Returns a useful HUD Position Vector from the llDetectedTouchPos(); function
// USE: vector pos = GetRealTouchPos(llDetectedTouchPos(0)); .. Etc.
// This function is intended to be used to move child prims to where the user clicks. This does not work on the root prim.
integer point = llGetAttached();
vector offset;
if (point == ATTACH_HUD_TOP_RIGHT) offset = <1.0, 0.933,-0.5>;
else if (point == ATTACH_HUD_TOP_CENTER) offset = <1.0, 0.000,-0.5>;
else if (point == ATTACH_HUD_TOP_LEFT) offset = <1.0,-0.933,-0.5>;
else if (point == ATTACH_HUD_BOTTOM_LEFT) offset = <1.0,-0.933, 0.5>;
else if (point == ATTACH_HUD_BOTTOM) offset = <1.0, 0.000, 0.5>;
else if (point == ATTACH_HUD_BOTTOM_RIGHT) offset = <1.0, 0.933, 0.5>;
//return (pos - llGetLocalPos()) + (offset * llGetLocalRot());
return ((offset - llGetLocalPos()) + pos) / llGetLocalRot();
}
|