Wondering if there is a better way to do the following:
Currently using the following code that is repeated for each side.
////forward hit
if (Physics.Raycast(transform.position + Vector3.forward / 2f, Vector3.down, out fhit, rayLength))
{
Gizmos.color = Color.green;
Gizmos.DrawRay(transform.position + Vector3.forward / 2f, Vector3.down * rayLength);
}
else
{
Gizmos.color = Color.red;
Gizmos.DrawRay(transform.position + Vector3.forward / 2f, Vector3.down * rayLength);
}
I’m wondering if there’s a better way? Maybe a for loop that sets the origin forward/2f then rotate 90 degrees, repeat 4 times… But I’m unsure how I’d rotate the ray in the for loop.
