Sets the rotation of the prim to rot.
void llSetRot( rotation rot );
Forced delay: 0.2 seconds. Energy: 10.0.
This function is available for nonphysical root prims and all child prims. It has no effect on the root prim if the object is physical. It has no effect for "static objects" as type of pathfinding
Drop this script in the root prim of an object to have it rotate in 1 degree increments. Note that it won't work on child prims if the root is rotated.
rotation rot_xyzq;
default
{
state_entry()
{
vector xyz_angles = <0,1.0,0>; // This is to define a 1 degree change
vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
}
touch_start(integer s)
{
llSetRot(llGetRot()*rot_xyzq); //Do the Rotation...
}
}
Drop this one in a child prim to have it rotate around the world's Y axis in 1 degree increments. It won't work in the root if it is rotated.
rotation rot_xyzq;
default
{
state_entry()
{
vector xyz_angles = <0,1.0,0>; // This is to define a 1 degree change
vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
}
touch_start(integer s)
{
llSetRot(llGetRot()*rot_xyzq/llGetRootRotation()/llGetRootRotation()); //Do the Rotation...
}
}
//-- These correctly set a global rotation for the root prim in all scenarios
llSetLocalRot( rot )
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot] )
//-- These correctly set a global rotation for a child prim in all scenarios
llSetLocalRot( rot / llGetRootRotation() )
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot / llGetRootRotation() ] )