LlRotBetween/ja

From Second Life Wiki

メインページ > LlRotBetween > LlRotBetween/ja
Jump to: navigation, search

関数: rotation llRotBetween( vector start, vector end );

start方向とend方向の間の回転のrotation値を返します。

• vector start
• vector end

仕様

startendは原点<0.0, 0.0, 0.0>からの相対的な方向です。異なる座標系を使用している場合、入力ベクトルからその座標系の原点を引き算しましょう。

警告

  • startendが、両方同じ大きさで、且つ、両方とも大きさが0でない場合のみ、start * llRotBetween(start, end) == endとなります。(回避策は#Notesを参照して下さい。)

llRotBetween(<1.0, 0.0, 0.0>, <0.0, -1.0, 0.0>)
// will return <0.00000, 0.00000, -0.70711, 0.70711> (which represents -45 degrees on the z axis)
 
llRotBetween(<0.0, 0.0, 0.0>, <0.0, -1.0, 0.0>)
// will return <0.00000, 0.00000, 0.00000, 1.00000> (which represents a zero angle on all axis)
// because <0.0, 0.0, 0.0> does not convey a direction.

ノート

この関数は、両パラメータの大きさが0でない場合に、start * llRotBetween(start, end) == endとなるように、大きさを調整します。両パラメータを同じ大きさにする必要はありません。

rotation RotBetween(vector start, vector end) //adjusts quaternion magnitude so (start * return == end) 
{//Authors note: I have never had a use for this but it's good to know how to do it if I did.
    rotation rot = llRotBetween(start, end);
    if(start)
    {
        if(end)
        {
            float d = llSqrt(llVecMag(end) / llVecMag(start));
            return <rot.x * d, rot.y * d, rot.z * d, rot.s * d>;
        }
    }
    return rot;
}//Strife Onizuka

関連項目

関数

•  llAngleBetween
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。
In other languages