Hello guys, I am improving my moving and crush platforms in my 2.5D game, for this I was needing one way to make a wider raycast. How I can't do this, I did the following function:

Code:

function multiRayCast( startPt : Vector3, dir : Vector3, hit : RaycastHit, distance : float ) : boolean { var iterations : int = 5; // Number of raycasts to be created inside this angle var angleToCheck : float = 45.0; // This angle var anglePartition : float = angleToCheck/iterations; //Starting from one extreme of the angle // Rotating the raycast for( /*nothing*/; iterations > 0; iterations-- ) { { return true; } //Rotating until rotate angleToCheck degrees } return false; }

Just look the image and become easier to understand it, it just cast various raycasts in the direction given to check if there is some hit inside of that magenta area. The problem is, the function returns true but the "hit" parameter in the caller function is empty. Anyone have some idea to solve this? Thanks