Issue with collision with PlayerCapsule

With the original assets depreciated, I downloaded the recommended set. The materials were off but I changed them to Standard and they now display correctly (probably). However, the assets that come with the first person assets include a tunnel, and I noticed that despite there being a box collider for both walls and the ceiling, only the wall colliders seem to stop my PlayerCapsule from moving, as shown in the picture. The capsule collider is exactly around the capsule mesh, though I did move the capsule up within the PlayerCapsule object so that the top of it was closer to “eye level”. Previously it was just the camera passing through the ceiling of the tunnel while the capsule was passing underneath.


Does anyone know why the collision isn’t working correctly here?

Edit: the capsule also ignores collision for the top of the doorway seen in the background.

Hi,

What exactly is the problem you would like to solve? How does the navmesh look like in your sceen?

This is prior to the Navmesh lecture. This is purely testing the movement of the PlayerCapsule that comes with the basic first person assets. My question boils down to “Why, when my capsule and the tunnel roof both have collision, can my capsule pass right through the roof (but not the walls)?”

I eventually discovered that in the Scene preview there seems to be a capsule collision shape attached to the parent PlayerCapsule object, and that is the one the game seems to use. If I raise the parent on the Y axis it correctly bumps against the ceiling. However, there is no capsule collider component in the inspector on the parent object, so I was hoping someone could shed light on how collision is working for that. Also, shouldn’t the collision on the capsule child object also influence where the whole game object can move? I’ll add pictures for clarification when I get back on.

Okay, in this image you can see I have moved the Capsule child object up on the Y axis relative to the parent object. Clicking on the parent PlayerCapsule you can see that there is a capsule collision shape left in place below, in addition to the collision shape around the capsule itself.


These next images show the inspector for the PlayerCapsule parent.


There is no capsule collider that I can see, so I don’t understand where that collider is coming from. On top of that, I don’t understand why the game ignores the collision on the capsule shape.

The CharacterContoller is a collider. This is the collider that is used by the movement. You should probably remove the collider from the capsule

Thanks for elaborating on the problem.

According to your screenshot, your ‘PlayerCapsule’ (= the root game object) has got a Rigidbody attached or gets one attached at runtime. In Unity, a rigidbody acts as a compound collider receiving the collision data from the child colliders. The collider is on ‘Capsule’ (= the child).

That highly depends on the type of movement and the speed. With a Rigidbody method, the player will be moved by the physics simulation. However, if it is too fast, it might be that it misses a collider, especially if the other collider is too thin.

Try what bixarrio suggested because you definitely don’t need two colliders for the player.

Privacy & Terms