Box collider doesn't call OnCollision functions.

Hi,
I have a box collider which is a child object that does not get rendered and always remains in front of the parent object.

When the box collider crashes into other box colliders using the AddForce function that is placed inside a .js file that is attached to the parent object, is there any reason why the OnCollision functions inside the child object don’t get called even though the physics of the child and parent object work?

Thank you,
Michael S. Lowe

This should work unless you’ve got the rigidbody on the child rather than the parent or if you’ve added the child object at runtime. The rigidbody should be on the parent along with the script. If you add the child at runtime, then the rigidbody won’t recognise it. In this case, you should remove the rigidbody with Destroy and the use GameObject.AddComponent to add a new one:-

Destroy(rigidbody);
gameObject.AddCompnent(Rigidbody);