Navigation marker in 3D game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By StarCatSTT

I am doing a small project about a battle on spaceships (3d). You need to add a marker / compass at the top of the screen that will point to the origin.
Problem getting the angle between the direction of the spaceship and the direction to the origin of the coordinate.
We need an angle only along the axis, as if it were a top view.

var ang = rad2deg(Vector2(1,0).rotated(rotation.y).angle_to(-Vector2(global_transform.origin.x, global_transform.origin.z)))
ang = clamp(ang, -45, 45)

I love Trig questions as much as the next guy but an image showing your intended results if you will as its very hard to ascertain from your words alone

Wakatta | 2021-01-26 02:39