Why is my Character's BoxCollider getting stuck in between two BoxColliders?

Hey y’all,

I am seeing this weird bug where my character’s BoxCollider is getting caught in the seam between two wall BoxColliders. This is a video example of what I am seeing. It only happens when I am moving diagonally into the seam. I have Continous Dynamic on my character’s RigidBody, and I am using rigidBody.MovePosition to move my character.

Here is what I have done to try and fix it:

  • Added a BoxCollider at the seam
  • Made the wall BoxColliders smaller
  • Added zero friction material to wall BoxColliders
  • Set Default Contact Offset to .000000001
  • Changed MovePosition to AddForce
  • Changed MovePosition to just setting the RigidBody.velocity
  • Changed my character’s collider to CapsuleCollider
  • Manually merged the two wall BoxColliders to one big BoxCollider

The latter two worked, but I would prefer to keep my character using a BoxCollider, and I would prefer to keep my wall colliders as individual BoxColliders (as to keep par with the course). Any help here would be greatly appreciated.

1 Like

Hi Dylan,

Welcome back to our community! :slight_smile:

I’m afraid I don’t understand your problem. The video looks normal. Could you point me to the second in the video and/or share a screenshot so I know what I am supposed to see?

Here are a few things you probably haven’t tried yet according to your list:

  • Select the walls and all non-moving game objects and tick off “Static” in their Inspector to increase the performance. Do not do that for game objects which are supposed to move during runtime.
  • Go to the Physic Settings and increase some of the values slightly.

Hey Nina!

Yeah I took a break to focus on work, but now I have some free time to learn! I’ll try your suggestions and get another video clip.

Basically, I have a wall made of two box colliders, but my character gets stuck in the seam of those two colliders instead of sliding along the side; again, this only happens while moving diagonal

Nina,

So I turned up my friction on my Physic Material slightly, and the definitely helped! Should I put a Physic Material on my Character too?

Also, here’s another clip

Where is the current physic material? If increasing the friction fixed the problem, it’s not necessary to add a physic material on the player. However, you could try that anyway.

So I tried the physic material on the character, still not perfectly seamless. Both of the frictions (static and dynamic) are 0.03, bounciness is 0, and the other two fields are set to Minimum.

Maybe you’ll have to create your own seamless collider mesh in Blender (or another 3D modelling software) and import it into Unity.

Yeah, that sounds about right! Thank you for your help Nina

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms