LlRotTarget/ja

From Second Life Wiki
< LlRotTarget
Revision as of 06:01, 12 April 2010 by Mako Nozaki (talk | contribs) (Undo revision 850252 by Mako Nozaki (Talk))
Jump to navigation Jump to search

要約

関数: integer llRotTarget( rotation rot, float error );

この関数は、スクリプトが回転が到着したときを知ることを試みます。roterrorを登録するとat_rot_targetが作動し、not_at_rot_targetイベントが登録が解除されるまで作動し続けます。

llRotTargetRemoveで対象を登録解除する処理を integer で返します。

• rotation rot 対象の回転target rotation
• float error rotが到着したときのラジアンの角度定義

よく似た関数が位置づけで存在します。llTarget
この関数はオブジェクトを回転しないので、llSetRotllRotLookAtllLookAtをつかいます。

サンプル

<lsl> vector standrot = <0.0, 0.0, 0.0>; vector fliprot = <45.0, 0.0, 0.0>;

// simple two-state rot target detection and rotation by Hypatia Callisto // works, to detect a rotation target. An example I wrote // since there is almost zilch for clean examples for // at_rot_target, not_at_rot_target, llRotTarget, llRotTargetRemove

integer rottarget;

default {

   state_entry(){ 
       rottarget = llRotTarget(llEuler2Rot(fliprot*DEG_TO_RAD), 0.1);
       llSetPrimitiveParams ([PRIM_ROTATION, llEuler2Rot(standrot*DEG_TO_RAD)]); // rotate to standrot
   }
   not_at_rot_target()
       { 
       llRotTargetRemove( rottarget );
       llOwnerSay("not there"); 
       }
       
   touch_start (integer total_number){
       state rotatestate; // change to state for new position
   }

}


state rotatestate {

   state_entry(){ 
       rottarget = llRotTarget(llEuler2Rot(fliprot*DEG_TO_RAD), 0.1);
       llSetPrimitiveParams ([PRIM_ROTATION, llEuler2Rot(fliprot*DEG_TO_RAD)]); // rotate to new point
   }
   
   at_rot_target(integer tnum, rotation targetrot, rotation ourrot){ 
       llRotTargetRemove( rottarget );
       llOwnerSay("there"); //reached the target
   }
   touch_start(integer touched){ 
       state default; 
   }
   

}

</lsl> <lsl> vector standrot = <0.0, 0.0, 0.0>; vector fliprot = <45.0, 0.0, 0.0>;

// simple two-state rot target detection and rotation by Hypatia Callisto // works, to detect a rotation target. An example I wrote // since there is almost zilch for clean examples for // at_rot_target, not_at_rot_target, llRotTarget, llRotTargetRemove

integer rottarget;

default {

   state_entry(){ 
       rottarget = llRotTarget(llEuler2Rot(fliprot*DEG_TO_RAD), 0.1);
       llSetPrimitiveParams ([PRIM_ROTATION, llEuler2Rot(standrot*DEG_TO_RAD)]); // rotate to starting point
   }
   not_at_rot_target()
   { 
       llRotTargetRemove( rottarget );
       llOwnerSay("not there"); //not at target
   }
       
   touch_start (integer total_number)
   {
       state rotatestate; // change to state for new position
   }

}


state rotatestate {

   state_entry(){ 
       rottarget = llRotTarget(llEuler2Rot(fliprot*DEG_TO_RAD), 0.1);
       llSetPrimitiveParams ([PRIM_ROTATION, llEuler2Rot(fliprot*DEG_TO_RAD)]); // rotate to new point
   }
   
   at_rot_target(integer tnum, rotation targetrot, rotation ourrot)
   { 
       llRotTargetRemove( rottarget );
       llOwnerSay("there"); //reached the target
   }
   touch_start(integer touched){ 
       state default; 
   }
   

}

</lsl>

関連項目

イベント

• at_rot_target not_at_rot_target 回転対象のイベント
• at_target not_at_target 位置対象のイベント

関数

•  llRotTargetRemove 対象の回転を停止します
•  llTarget 対象の位置を設定します
•  llTargetRemove 対象の位置を停止します

特記事項

Search JIRA for related Issues

Signature

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