- Home /
Collision Detection does not work in my scene
Hello all, I am trying to setup collision detection in my scene but it can never seem to work.
Right now, I am controlling a Character object using FirstPerson. I attached a SphereCollider to the object and attatched a BoxCollider to the object it needs to collide with.
When I test it however, it just walks through it.
I then attached this Script to the FirstPerson object:
public class Collisions : MonoBehavior {
void OnCollisionEnter(Collision c) {
Debug.Log("Collide");
}
}
But nothing happens when it should be colliding.
I have now tried attaching a rigid body to the Sphere, and still do not get any response.
Is there anything else I should try?
Thanks.
Answer by rutter · Apr 07, 2012 at 01:44 AM
I realize this checklist may sound dumb or laborious, but it's important to get it out of the way:
Make sure that both objects have colliders attached.
Make sure that at least one object has a non-kinematic rigidbody attached.
Make sure that at least one object has a script which responds to collisions (like your
Collisions
script).If you've customized your physics settings, make sure that both objects are on layers which should be colliding.
Dang it! I didn't have it set as being non-kinematic! Thank you! (I need to figure out what that means now...)
There are so many little things. ;)
(In a nutshell, a kinematic rigidbody isn't affected by forces or velocity, and will only move if you explicitly move it.)
Your answer
Follow this Question
Related Questions
Again about the platforms... 0 Answers
collission not triggered when i touch object.. 1 Answer
Rigidbody collision detection using iTween 3 Answers
Generic Question concerning Collisions 0 Answers