- Home /
Unity4.0 collider.enabled no longer works ?
dexl : "After I updated from Unity3 to Unity4, I encounter this weird problem....
When I set "collider.enabled = false;" Raycast's hitinfo.collider still picks it up, is it something wrong with my Unity or there is a feature change that I missed?"
Same for me.
Answer by Nidre · Apr 10, 2013 at 11:29 AM
Is the GameObject which has the collider you are checking for has any childs that also have colliders ?
If you dont add rigidbody to child objects their colliders act like a single collider which might be causing your problem.
Check Compund Colliders in here : http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html
No, the object which I am testing for raycast has a $$anonymous$$eshCollider and no children but a parent with a BoxCollider.
So the same principle might be still applying try disabling both to see if that is the case.
If this is the case you can solve it by adding rigidbody to each colliders game object.That way they will act independentyl of each other.You can enable iskinematic to make the rigidbody kind of "passive".
Your answer
Follow this Question
Related Questions
Layered Collisions 1 Answer
What drawback of frequently changing of Game Object's Layer? 0 Answers
Layer Collision issue 1 Answer
How does Raycast layer mask work? 1 Answer
Collision Detection If Raycast Source Is inside A Collider? 4 Answers