Fortran
Sep 5 2009, 00:41
Ok I am turning to ask for help after several failed attempts at something which is probably quite simple. I need to obtain the 2D direction (from the player) to a waypoint or marker. Unfortunately my math is poor to say the least so I am really struggling to get a grip on what calculations I need to make. Sorry for the poor illustrations here but the basic premise is...
For example: ( > = player facing direction)
*****************************
^
player_____________Xwaypoint/marker
value returned = 90
*****************************
or
*****************************
player >___________Xwaypoint/marker
value returned = 0
*****************************
or
*****************************
Xwaypoint/marker
|
|
|
|
|
player
\/
value returned = 180
*****************************
etc. etc. Basically I need to get a 2d direction of an object relative to the players facing direction and convert that to a value between 0 and 359. It doesn;'t matter which direction the waypoint/marker is facing (obviously) just it's direction relative to the direction the player is facing. Obviously getting the direction of the player with GetDir is fine and getting the position of the marker or waypoint is fine, its just the calculation inbetween I cannot get my head around.
Any help at all is hugely appreciated.
For example: ( > = player facing direction)
*****************************
^
player_____________Xwaypoint/marker
value returned = 90
*****************************
or
*****************************
player >___________Xwaypoint/marker
value returned = 0
*****************************
or
*****************************
Xwaypoint/marker
|
|
|
|
|
player
\/
value returned = 180
*****************************
etc. etc. Basically I need to get a 2d direction of an object relative to the players facing direction and convert that to a value between 0 and 359. It doesn;'t matter which direction the waypoint/marker is facing (obviously) just it's direction relative to the direction the player is facing. Obviously getting the direction of the player with GetDir is fine and getting the position of the marker or waypoint is fine, its just the calculation inbetween I cannot get my head around.
Any help at all is hugely appreciated.