Hey - I have a script set up to shoot rays into the scene. I want them to ignore the walls of my scene, which I have assigned a tag called Walls. Here’s my script: I’m not sure why it’s not working. I get the error “object reference not set up to an instance of an object”.
var projectile : Rigidbody;
var speed = 20;
var boundaryRef;
function Start(){
boundaryRef = GameObject.FindGameObjectsWithTag ("Walls");
}
function Update()
{
if( Input.GetButtonDown( "Fire1" ) ){
//instantiate a projectile and throw it toward the cube (x axis)
var instantiatedProjectile : Rigidbody = Instantiate( projectile, transform.position, transform.rotation ) ;
instantiatedProjectile.velocity = transform.TransformDirection( Vector3( speed, 0, 0) );
Physics.IgnoreCollision( instantiatedProjectile.collider, boundaryRef.collider); //make sure to ignore collision between launcher and missile
}
};