オブジェクトの座標を取得する †
Top > llGetPos()
- vector? pos = llGetPos();
戻り型はvector?型でX,Y,Zの座標を返します。
下記サンプルは、オブジェクトが上昇するサンプルコードですが、
なぜか、Z、Y座標を同時に動かすと、
pos = pos + <0,0,1>;
↓
pos = pos + <0,1,1>;
オブジェクトが正しくもとの位置に戻りませんでした。
(なぜ?、ベクタの計算式の使い方が間違っているのか・・・・)
関連項目 †
サンプルコード †
vector pos_start;
default
{
state_entry()
{
//llSay(0, "Hello, Avatar!");
}
// 触られたときに発生するイベント
touch_start(integer total_number)
{
integer i;
vector pos = llGetPos();
pos_start = llGetPos();
llSetText((string)pos_start,<0,2,1>,1);
for(i = 0 ; i < 10 ; i++ ){
pos = llGetPos();
pos = pos + <0,0,1>;
//pos = pos + <0,1,1>;
llSetPos( pos );
}
llSetTimerEvent(5.0);
llSetText("",<0,0,0>,0);
}
// タイマーで発生するイベント
timer(){
llSetTimerEvent(0);
llSetPos( pos_start );
}
}
質問その他、突っ込みよろしく †
最新の20件
2010-03-17
2010-03-16
2010-03-15
2009-12-23
2007-11-28
今日の15件
- counter: 2259
- today: 1
- yesterday: 0
- online: 1