I am trying to create a waypoint system, where at the start of the level each waypoint finds all the waypoints that it can “see.” I want each waypoint to Raycast to all the other waypoints and store the waypoints that the Raycast can hit in an array. I get the error: No appropriate version of ‘UnityEngine.Physics.RaycastAll’ for the argument list ‘(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.RaycastHit)’ was found.Here’s the code:
var wayPoints : GameObject[];
var nextPoints : GameObject[];
var myPoint = transform.position;
function Start() {
wayPoints = GameObject.FindGameObjectsWithTag("Waypoint");
var hits : RaycastHit[];
var rayDirections : Vector3[] = (wayPoint.position - transform.position).normalized;
for (var i = 0; i < hits.length; i++) {
if (Physics.RaycastAll(myPoint, rayDirections_, hits*)) { *_
* if ( hits.collider.gameObject.tag == “Waypoint” ) {*
* nextPoints = hits.collider.gameObject;*
* }*
* }*
* }*
}