Hello, I’m trying to detect the collision between two game objects. The first object is a static sphere collider with a rigidbody attached, on a user defined layer and no gravity enabled.
The second object is a user controlled sphere collider (parented) with no rigidbody attached and on the same user defined layer as the static collider.
I think because the first static game object doesn’t move, its rigidbody goes to sleep and stops detecting collision with the player.
And so I’ve added a rigidbody to the player on the parented sphere collider. But I think because the rigidbody is parented to the player and I use a character controller to move the player, that rigidbody is also considered nonmoving and also goes to sleep.
How am I supposed to detect collisions now? Is there a certain best practice to follow when creating my player prefabs in terms of components and parenting?
If your first object is static and you just want to know when player (second object) enters its bounds, you could remove the first object’s rigidbody and make it a static trigger.
I don’t think the player’s rigidbody child should fall asleep.
Are your layers correct? Double-check Edit > Project Settings > Physics to make sure collisions are enabled.
To get verification that sleeping is the real problem, you could add a temporary test script to keep the rigidbodies awake. Something like: