- Home /
Confusion about collider states
I have two mesh colliders in my scene, and they share pretty much the same position. Only one is ever active at any one time.
When I first load my scene, only one is active, but in the scene inspector I can see both when I select them (I added some gizmos code to show the collider bounds as well). This is not the problem I am having, I want to be able to see the collider volumes even if inactive.
After scene load, if I manually activate the inactive collider, then deactivate it, I can no longer see the bounds like I did when I loaded the scene.
I am trying to understand why this happens, and how to prevent it if possible. I need to spherecastall against these, and expect to see both results regardless of if they are active or not (as spherecastall does).
So, what is happening when I trigger the active state of a collider AFTER the scene has loaded??? how can I keep the collider active for raycasts without being active for collisions with other colliders?
Answer by rageingnonsense · Dec 28, 2015 at 06:50 PM
I figured out there is a bug with the state of colliders being set in the first frame. Don't know why but it is just the way it is.
My solution is to make use of Physics.IgnoreLayerCollision, and just swap the layers of the objects instead of changing the active state of the colliders.