I have a compass that is pointing towards player forward direction.
direction.z = player.eulerAngles.y;
if (_transform.localEulerAngles.y != direction.z)
{
_transform.localEulerAngles = direction;
}
I have indicators for each objective. I'm trying to rotate the indicator towards quest objectives as seen in image bellow.
float angle = Vector2.Angle(player.transform.position - player.transform.forward, objective.position);
objectivePositionUI.anchoredPosition = new Vector3(
Mathf.Cos((angle * 2 * Mathf.PI) / 180f) * radius,
Mathf.Sin((angle * 2 * Mathf.PI) / 180f) * radius,
0f
);
My result atm
My problem here is that the yellow dots (objectives) should be rotated at the same direction as arrow in this case because I am facing the quest objectives head on.