This is the view from my spaceship. It can move around in 3d space and turn up, down, left and right.
The planet Earth on the top right is selected. Now I want to create the red arrow to always point to the direction of Earth even if my ship is facing away from it.
this is my code so far
//These are euler angles Vector3 wantedheading = SelectedObject.transform.position - Statics.Player.transform.position; Vector3 curentheading = Statics.Player.transform.localRotation.eulerAngles; Quaternion qwanted = Quaternion.Euler(wantedheading); Quaternion qcurent = Quaternion.Euler(curentheading); Quaternion qMove = Quaternion.FromToRotation(curentheading, wantedheading);
but now I have a 3d rotation... what do I do to make it into a 2d rotation always pointing to the shortest direction to the planet?