LlRotTarget
Looking for the current API? Open the llRotTarget reference →
Wiki description
This function is to have the script know when it has reached a rotation.
It registers a
It registers a
rot with a error that triggers at_rot_target and not_at_rot_target events continuously until unregistered.Function notes
A similar function exists for positions: llTarget
This function does not rotate the object, to do that use llSetRot, llRotLookAt or llLookAt.
This function does not rotate the object, to do that use llSetRot, llRotLookAt or llLookAt.
Return value notes
Returns an integer to unregister the target with llRotTargetRemove
Examples
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;
}
}See also: functions
See also: events
Shared wiki helpers
The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.
Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.