- Home /
Question by
Temo2Ginal · May 26, 2014 at 06:59 AM ·
collidertrigger
Box Collider - Trigger doesn't respond on whole gameObject
Hello. I have the basic scene, Floor, Wall (which has box collider , so if U miss the target Bullet hits this collider and bullet "Deletes"), two "Target" boxes called "Red" and "Green". The thing is, when i fire my bullet and it hit's i.e "Red", some Areas of the Box Collider doesn't respond , some areas work fine.
Box COllider is exact same size as the "Red" gameobject.
Photos:
There it not responds (Number in Red is not increasing)
There it works fine
BulletScript:
using UnityEngine;
using System.Collections;
public class BulletScript : MonoBehaviour {
public float duration = 1;
public float bulletSpeed = 10;
public PlayerScript pScript;
public GameObject Player;
void Start()
{
Player = GameObject.Find("Player");
pScript = Player.GetComponent<PlayerScript>();
}
// Update is called once per frame
void Update ()
{
transform.Translate (Vector3.forward * bulletSpeed);
}
public void OnTriggerEnter(Collider other)
{
if (other.gameObject.name == "Red") {
pScript.redHit++;
print("Rrrr");
}
else if (other.gameObject.name == "Green") {
pScript.greenHit++;
}
//Debug.Log (redHit);
Destroy (gameObject.gameObject);
}
}
Sorry for my English
Comment