Hello devs,
I’m trying to make a field of vision for a basic Artificial Intelligence. I’m just having trouble with the rotation part.
I used “DrawWireDisc” to get a debug.
viewRadius=5;
Handles.DrawWireDisc(tr.position, tr.forward, viewRadius);
Vector3 angle1 = new Vector3(Mathf.Sin(viewRadius * Mathf.Deg2Rad), Mathf.Cos(viewRadius * Mathf.Deg2Rad), 0);
Vector3 angle2 = new Vector3(Mathf.Sin(viewRadius * Mathf.Deg2Rad), Mathf.Cos(viewRadius * Mathf.Deg2Rad), 0);
Handles.DrawLine(tr.position, tr.position + angle1 * viewRadius);
Handles.DrawLine(tr.position, tr.position + angle2 * viewRadius);
The problem is that when the angle is changed when I change the rotate.y instead of the rotate.y
As the game is 2d I just do the rotation for y.
What am I doing wrong?
(In the images I change the rotation in y. And the opening of the angles does not move.)