I am pretty new to 3D but boldly started out trying to implement a spaceship simulator. There is a kind of stellar navigation that I’d like to implement https://worldbuilding.stackexchange.com/questions/23040/creating-a-realistic-worlds-map-stars
The lines originate from a center on a 2D plane to a point above or below the place of interest (Planet in my case) and then lead up- or downward to the point. Since I now all coordinates of all planets this was fairly easy. I already have it working and I am satiesfied how it worked out.
However, my current code only works from a very static perspective. While the spaceship moves around, I would like the map to adapt - not just with regard to the spaceships position (which would be simply adding/substracting the players coordinates), but also with regard to the ships orientation.
E.g.: If the player turns the ship to a planet right below his current heading, his own perspective on his current horizont (the blue circles in my link above) changes. Everything directly ahead of him is somewhere on his perceived Z-axis, etc.
I can try to dig out my trigonometry from school, but I guess there are easier solutions. So I would be grateful for some hints what functions I could use to calculate relative positions of an object with regard to an absolute position and a rotation of a player
Or if you have things in world space and you want to find out where they are in local space… to create a map in local space (ie: based on the horizon of the ship) then you can either use spatial.worldToLocal()… or if you don’t have a convenient spatial representing the ship you can look at the code for worldToLocal() to see what it does.