Template:Needs Translation/
函数名
|
Function: rotation llGetRot( );
|
参数:
|
返回值:返回一个旋转,该旋转是基本物体相对于区域轴的旋转。
|
示例
|
//-- rotates an object to face the nearest cardinal direction (N,E,S,W)
//-- assumes build is aligned to root object facing
default{
state_entry()
{
llSay( 0, "Rotate me in edit, then touch to make me face the nearest compass point" );
}
touch_start( integer vIntTouches )
{
//-- convert our rotation to x/y/z radians
vector vRadBase = llRot2Euler( llGetRot() );
//-- round the z-axis to the nearest 90deg (PI_BY_TWO = 90deg in radians)
llSetRot( llEuler2Rot( <0.0, 0.0, llRound( vRadBase.z / PI_BY_TWO ) * PI_BY_TWO > ) );
}
}
|