I thought maybe I can draw two vectors based off of the character's transform.forward vector (one vector on each side of the transform.forward vector). For example, how would I draw vectors 70 degrees from transform.forward? The middle line represents transform.forward and the two angle lines represent the 70 degree vectors: "
\ | / "
var rayRange = 10;
function OnDrawGizmosSelected ()
{
Gizmos.color = Color.magenta;
Gizmos.DrawRay (transform.position, transform.forward * rayRange);
}
Thanks!
Try using Quaterion.AxisAngle to create a rotation.
So, something like this:
void OnDrawGizmosSelected()
{
float totalFOV = 70.0f;
float rayRange = 10.0f;
float halfFOV = totalFOV / 2.0f;
Quaternion leftRayRotation = Quaternion.AngleAxis( -halfFOV, Vector3.up );
Quaternion rightRayRotation = Quaternion.AngleAxis( halfFOV, Vector3.up );
Vector3 leftRayDirection = leftRayRotation * transform.forward;
Vector3 rightRayDirection = rightRayRotation * transform.forward;
Gizmos.DrawRay( transform.position, leftRayDirection * rayRange );
Gizmos.DrawRay( transform.position, rightRayDirection * rayRange );
}