Turns out it is a lot easier than you'd think. All you have to do is Camera.project(Vector3)
and that returns a vector3 you can get the x and y from.
Converting 3D coordinates to 2D coordinates in Libgdx
-
10-07-2023 - |
Question
I'm trying to mark a model that is moving in 3D on my 2D screen, I have position of both objects in 3D and they only move along the x and z axis so Y isn't an issue here.
Since I can't explain this that well I drew 3 pictures.
The one in the top right is the information I have, the middle left is an example of what they would look like looking down on the x z axis and the bottom one is what I'm trying to accomplish, putting some indicator around the position of the players.
If anyone knows the formulas for doing this or links to an example, that'd be great. Thanks :)
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow