3
\$\begingroup\$

I have such question:

how to calculate angle between player and end point?

Things, which i have:

  1. Player. I have X, Y, Z position of player and his Z-angle (0-360)

  2. Endpoint. I have only X, Y, Z position of end point.

Task:

Rotated player Z-angle to end point.

How i can did this?

Please, help :3

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

If I understand you correctly, you want

z_angle = atan2(target_y - player_y, target_x - player_x); 
\$\endgroup\$
1
  • \$\begingroup\$ Don't forget to take the player's current facing angle into account! \$\endgroup\$ Commented Jan 1, 2019 at 13:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.