I'm cooking up a dash for use in vehicles, and one thing I would like is a waypoint indicator... basically an indicator to point back to your start, or last selected waypoint. Problem is, I have no clue how to figure out the angle (around the z axis) between two given points. Here is a simplified example....
Can anyone point me in the right direction for figuring out the angle?
-----------------------
vector waypoint ;
vector current ;
float reverseheading ;
default
{
state_entry()
{
waypoint = llGetRegionCorner() + llGetPos() ;
llSetTimerEvent(.5) ;
}
touch_start (interger total_number)
{
waypoint = llGetRegionCorner() + llGetPos() ;
}
timer()
{
current = llGetRegionCorner() + llGetPos() ;
// Now here is where I'm baffled. How do I determine the angle
// (around the z axis) FROM current to waypoint?
// Conversely, how would I determine the angle FROM the waypoint to current?
// Just subtract PI, correct?
reverseheading = ????
llSay (0, (string) reverseheading) ;
}
}
