I need to project 3D coordinates (the player’s position X Y Z (see red axis and red points)) on the 2D X’ and Y’ axis in order to represent, on the 2D image, the player’s location based on his 3D position.
I already try multiple solutions (based on sin/cos), but i can’t figure out how to project it correctly.
And I think I need an offset and scale to adjust the projection properly but i don’t know how to determine it.
When working on this projection:
- does Y axis is 40° or 140° ?
- does X axis is -30° or 150° ?
Additional detail: the arrow indicate the increase direction and the angle relative to horizontal
Image caption:
-
red axis: 3D coordinates (player position in game)
-
red points 1,2,3,4: are real 3D coordinates in game
-
green axis: 2D coordinates (player position on the image)
-
green coordinates: correspond to the image position (in 2D ref) of the corresponding red point (3D)
PS: code response (JS, lua, PHP) is preferable over math notation
Thank’s