- Home /
Not Detecting Collision?
Ok so I made a node based Path Finding script for generating random paths:
     var Waypoints : GameObject[];
 
     function onTriggerEnter (collision : Collider){
        if (collision.gameObject.FindWithTag("Enemy")){
           var random : int;
           random = Random.Range(1,2);
           var place : GameObject = (Waypoints[random]);
           SendMessage("NextLocation", place, SendMessageOptions.DontRequireReceiver);
           Debug.Log("Sent");
        }
     }
where an Object moves towards a Waypoint determined by the script. The only problem is that the Waypoint with this script never detects the collision with the Object since I never receive the debug. I have a box collider on the waypoint and a rigid body on the object, so I have no idea why it wouldn't detect the collision. Any ideas?
 collision.gameObject>FindWithTag("Enemy")
Please explain.
its looking to see if the collision object is a "Boss" enemy rather than a regular-ol' badguy.
Look at the spelling of your function name, and compare that to the spelling of the function name in the docs. (Hint: pay extra attention to the first letter. ;) )
woops the gameObject>FindWithTag was a typo when i copied it between computers, my bad. But thanks Eric that lower case "o" seemed to be the problem
Answer by crazyKnight · Dec 21, 2011 at 10:48 AM
collision.gameObject>FindWithTag("Enemy")) ????????
collision.gameObject.FindWithTag("Enemy"))
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                