- Home /
Why won't my box collider collide?
Hi, I've got a box collider attached to a character controller. When I move the character controller, the box collider won't collide when it comes into contact with, say, a wall. Because it's acting as my gun, the player can simply stick it through the wall and fire... not acceptable. So, is there a way to do this, and if so, how?
Answer by Cyclops · May 01, 2010 at 10:34 PM
I thought I remembered another Question that answered that, and just found it - ironically, it's your post :) Seagulls flying through models, in which you say a script always overrides physics.
Since the Character Controller uses a script, FPSWalker, I would guess that overrides the box Collider.
"A script always overrides physics" isn't really accurate, considering you can add physics forces naturally in a script, or use movement methods that react to colliders. Setting an object directly using transform.position
or transform.Translate
will override physics though. However that's not what's going on here...CharacterController.$$anonymous$$ove() does in fact react to colliders.
Answer by Narven · May 01, 2010 at 08:17 PM
You need to create a collider for the gun.
Yeah, I did that. And yet it persists in penetrating my walls.
Answer by Eric5h5 · May 01, 2010 at 10:56 PM
A character controller uses a capsule collider only. If you want to use other colliders, you'll have to use something other than a character controller.
Answer by GamersFrenzy · Jul 15, 2014 at 04:10 AM
Not the script, add Rigidbody to both the Player and the Trigger Collider and check kinematic on both I also set Collision Detection to continuous That should help out.
Your answer
Follow this Question
Related Questions
Character Controller Object Randomly Falls Through Colliders 3 Answers
3D combat in Unity 2017 3 Answers
When jump my character controller model it goes out of collider 0 Answers
FPS controller prefab and grenade script 2 Answers
Difference between character controller and Rigidbody + Collider 1 Answer