Thanks
integer targetID;
default
{
touch_start( integer total_number )
{
// Become a physical object
llSetStatus(STATUS_PHYSICS, TRUE);
llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
//llWhisper( 0, "we're on our way" );
// destination is ten meters above our current position
vector destination1 = llGetPos() + <20, 0, 0>;
// how close is close enough
float range = 0.5;
// Ask to be informed whether we're there or not
targetID = llTarget( destination1, range );
// Start moving towards the destination
llMoveToTarget( destination1, 10 );
}
not_at_target()
{
// We're not there yet.
//llWhisper(0, "Still going"
;}
at_target( integer number, vector targetpos, vector ourpos )
{
//llSay(0, "We've arrived!"
;// Stop notifications of being there or not
llTargetRemove(targetID);
// Stop moving towards the destination
llStopMoveToTarget();
// Become non-physical
llSetStatus(STATUS_PHYSICS, FALSE);
vector eul = <0,0,-180>; //45 degrees around the z-axis, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llSetRot(quat); //rotate the object
// Become a physical object
//llSetStatus(STATUS_PHYSICS, TRUE);
//llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
//llWhisper( 0, "we're on our way" );
// destination is ten meters above our current position
vector destination2 = llGetPos() + <0, 2, 0>;
// how close is close enough
float range = 0.5;
// Ask to be informed whether we're there or not
targetID = llTarget( destination2, range );
// Start moving towards the destination
llMoveToTarget( destination2, 10 );
}
not_at_target()
{
// We're not there yet.
//llWhisper(0, "Still going"
;}
at_target( integer number, vector targetpos, vector ourpos )
{
//llSay(0, "We've arrived!"
;// Stop notifications of being there or not
llTargetRemove(targetID);
// Stop moving towards the destination
llStopMoveToTarget();
// Become non-physical
llSetStatus(STATUS_PHYSICS, FALSE);
vector eul = <0,0,-180>; //45 degrees around the z-axis, in Euler form
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion
llSetRot(quat); //rotate the object
}
}
