Difference between revisions of "LlDetectedPos/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LSL_Function/detected/ja|number|pos}}
{{LSL_Function/detected/ja|number|pos|error=[[ZERO_VECTOR/ja|<0.0, 0.0, 0.0>]]}}{{LSL_Function/ja
{{LSL_Function/ja
|func_id=35|func_sleep=0.0|func_energy=10.0
|func_id=35|func_sleep=0.0|func_energy=10.0
|sort=DetectedPos|func=llDetectedPos
|sort=DetectedPos|func=llDetectedPos
|return_type=vector
|return_type=vector
|p1_type=integer|p1_name=number
|p1_type=integer|p1_name=number
|func_footnote='''number'''が検出されたオブジェクトの妥当な番号ではないとき{{LSLG|ZERO_VECTOR/ja|<0.0, 0.0, 0.0>}}が返ります。
|func_footnote='''number''' が検出されたオブジェクトの妥当な番号ではないとき {{LSLG|ZERO_VECTOR/ja|<0.0, 0.0, 0.0>}} が返ります。
|func_desc
|func_desc
|return_text={{LSLGC|Detected|検出}}したオブジェクトの位置
|return_text={{LSLGC/ja|Detected|検出した}} オブジェクト番号の ([[Viewer_coordinate_frames/ja#Region|リージョン座標]] での) 位置
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples=
|examples=
<lsl>//--// get sim position of Avatars in "say" range //--//
<source lang="lsl2">//--// チャット範囲内にいるアバターの SIM 内座標を取得します //--//
 
//-- @@ = Contains code optimizations, see the following page for details
//-- https://wiki.secondlife.com/wiki/User:Void_Singer/Optimizations


default
default
Line 26: Line 22:
   touch_start( integer vIntTouchCount )
   touch_start( integer vIntTouchCount )
   {
   {
     //-- trigger the sensor for avatars within 20m
     //-- 20 m 以内にいるアバターをセンサーで検出します
     llSensor( "", "", AGENT, 20, PI );
     llSensor( "", "", AGENT, 20, PI );
   }
   }
Line 33: Line 29:
   {
   {
     integer vIntCounter = 0;
     integer vIntCounter = 0;
     //-- loop through all avatars found
     //-- 見つかったアバターでループを回します
     do
     do
     {
     {
       llOwnerSay( llDetectedName( vIntCounter )
       llOwnerSay( llDetectedName( vIntCounter )
                   + " @ "
                   + " @ "
                   //-- the next line gets the position of each found avatar
                   //-- 次の行でそれぞれのアバターの座標を取得します
                   + (string)llDetectedPos( vIntCounter ) );
                   + (string)llDetectedPos( vIntCounter ) );
     }while (++vIntCounter < vIntFound); //-- @@
     }while (++vIntCounter < vIntFound); //-- @@
   }
   }


   //-- sensor does not detect owner if it's attached
   //-- 装着されている場合、センサーはオーナーを感知しません
   no_sensor()
   no_sensor()
   {
   {
     llOwnerSay( "I couldn't find anybody" );
     llOwnerSay( "I couldn't find anybody" );
   }
   }
}</lsl>
}</source>
|helpers
|helpers
|also_functions
|also_functions

Latest revision as of 15:30, 25 February 2016

要約

関数: vector llDetectedPos( integer number );

検出した オブジェクト番号の (リージョン座標 での) 位置を vector で返します。

• integer number 探知情報の番号

number には 負のインデックス を使用できません。 number が検出されたオブジェクトの妥当な番号ではないとき <0.0, 0.0, 0.0> が返ります。

仕様

llDetected* 関数はどこでも使用可能ですが、探知イベント (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) の中、または探知イベントで呼ばれた関数の中で呼び出されたときのみ使用可能な値を返します。

警告

  • number が正常なインデックス範囲を外れていても、この関数は <0.0, 0.0, 0.0> を返し、スクリプトはエラー表示を出さずに処理を続けます。
  • llDetected* 関数が有効になるイベントは、常に少なくとも 1 個以上の探知結果を返します。
    • 何も探知されなかった場合、探知イベントは発生しません。[1]
    • 探知イベントの探知個数を表す引数は、最初は決して 1 未満にはなりません。[2]
All Issues ~ Search JIRA for related Bugs

サンプル

//--// チャット範囲内にいるアバターの SIM 内座標を取得します //--//

default
{
  state_entry()
  {
    llOwnerSay( "Touch me to get the positions of avatars in 'Say' range" );
  }

  touch_start( integer vIntTouchCount )
  {
     //-- 20 m 以内にいるアバターをセンサーで検出します
    llSensor( "", "", AGENT, 20, PI );
  }

  sensor( integer vIntFound )
  {
    integer vIntCounter = 0;
     //-- 見つかったアバターでループを回します
    do
    {
      llOwnerSay( llDetectedName( vIntCounter )
                  + " @ "
                   //-- 次の行でそれぞれのアバターの座標を取得します
                  + (string)llDetectedPos( vIntCounter ) );
    }while (++vIntCounter < vIntFound); //-- @@
  }

   //-- 装着されている場合、センサーはオーナーを感知しません
  no_sensor()
  {
    llOwnerSay( "I couldn't find anybody" );
  }
}

関連項目

記事

•  検出

特記事項

Search JIRA for related Issues

脚注

  1. ^ 例外は no_sensor ですが、ここでは llDetected* 関数は有効にはなりません。
  2. ^ 他のあらゆるイベント引数と同じように、ユーザは初期値を上書きすることができます。

Signature

function vector llDetectedPos( integer number );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。