Maybe I’m missing something dumb but I have two box colliders, on two different layers.
I have the following code attahced to one of the gameobjects that contains a box collider, but this method never fires when the two colliders interact.
void OnCollisionEnter(Collision col) {
// Code here for collision, but this method never fires
}
1.) I have checked the collision matrix, both layers are set to collide with each other
2.) One of the colliders has a rigidbody attached
3.) The colliders are not set to be triggers.
4.) I’ve tried modifying the layer overrides, no difference.
Am I missing something?
I can only ever get it to fire with OnTriggerEnter, by marking my one object as a trigger. But otherwise can never get OnCollisionEnter to fire.
You can have the script on the collider that has the dynamic Rigidbody as an ancestor, but putting a script on a non-Rigidbody-backed collider is not going to reliably be informed of collisions.