- Home /
Colliders won't work (Closed)
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;
}
}
Answer by Chronos-L · May 29, 2013 at 09:13 AM
Have you took a look at the collision matrix table at the bottom of this page?
Furthermore, I am not really sure about this code segment
function OnCollisionEnter() {
Debug.Log("Hit Something!");
}
But I am sure that the following will work if the colliders are setup properly:
function OnCollisionEnter(collisionInfo : Collision) {
Debug.Log("Hit Something!");
}
Hey, so the way I fixed this was by just starting a new project. That is all I needed to do and it worked fine ^^ But thanks for the help, also turned out that the collision only works when the Bullet is at a very slow rate and a rigid body. Anyways, thanks for your help!
Answer by Sebulec · Sep 30, 2013 at 12:35 PM
I have the same problem and i've tryed almost everything (install patch reset uninstall) and colliders don't work . U used simple scripts like UP and theres no reaction...
Your answer
Follow this Question
Related Questions
Instantiated object won't collide with particles 1 Answer
Accessing variables in enemy. 2 Answers
Bullet reflect not working properly 1 Answer
Colliders not interacting 0 Answers