Hello again, my Bullet with the following script triggers a collider that should only trigger for the tag.player
public float bulletSpeed = 10;
public Rigidbody bullet;
void Fire()
{
Rigidbody bulletClone = (Rigidbody)Instantiate(bullet, transform.position, transform.rotation);
bulletClone.velocity = transform.forward * bulletSpeed;
}
void Update()
{
if(Input.GetButton("Fire2"))
{
if (Input.GetButtonDown("Fire1"))
Fire();
}
}
and here the collider script
private Light[] lights;
public GameObject lightParent;
void start(){
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
lights = lightParent.GetComponentsInChildren<Light> ();
foreach (Light light in lights) {
light.enabled = true;
}
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
lights = lightParent.GetComponentsInChildren<Light> ();
foreach (Light light in lights) {
light.enabled = false;
}
I don’t want my bullets to trigger the collider (looks like a disco lightshow).
Thanks.