0 votes

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)
Godot version 3.2.3
in Engine by (12 points)

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.