Hey, I’ve been having problems with Unity collider. I’ve already asked a similar question but this guy couldn’t help me out and it just brought up more questions. The OnCollisionEnter function doesn’t really seem to work. I tried out several simple collision scripts on my bullet, such as this one:
function OnCollisionEnter() {
Debug.Log("Hit Something!");
}
Unity did not Log the hit. I checked on most other factors, colliders, the layer pyramid, nothing works…If someone could help or give some suggestions as to why it doesnt work, it would be a great help, this is really hindering my process. BTW this is the script i wanted to get to work initially:
/Variables (START)_________
//The particles that will Instantiate on hit
var mudParticle : GameObject;
//Variables (END)___________
function OnCollisionEnter(hit : Collision){
if(hit.gameObject.tag == "floorMud"){
Debug.Log ("Hit");
Instantiate(mudParticle, transform.position, transform.rotation);
transform.renderer.enabled = false;
gameObject.GetComponent(SphereCollider).enabled = false;
}
}