I’m sure this is a known problem, I just have no idea what to search for, so bear with me.
I have two cubes of exactly the same size. I place on right next to the other as two ground tiles and slide another cube on top of them.
For some reason, the cube on top will collide/bump with the edge of the next ground cube. I’ve noticed this happening multiple times and it’s starting to be a pain in my projects.
The typical solution to this is to round the edges of you moving object. This is why character controller typically use capsules instead of cylinders.
The other option is to use a single collider to represent all of your floor objects. This is ideal if things are static and won’t be moving. However it can also work with moving floor objects if you want to build a collider dynamically at runtime.
There are other, more complicated methods to use. But they start to get very use case specific.
Probably because the collision normal is different when calculated at points on the edge. When a collision normal is calculated it does not take adjacent colliders into account, because that would be computationally expensive.
If you need the two ground cubes to act as one collider then are you able to make them one collider? Ie: have one box collider that fits over both boxes? In a non-trivial game that’s probably not a reasonable solution, but you could (for example) copy the top faces of all of your “floor” meshes into a mesh collider.
We are building levels combining multiple ground floors into one.
Using a rounded collider would prevent objects from being stuck on the edge, but still gives a bump some times and feels weird.
Combining two cubes into one might work, but would required us to change a big portion of our level creation scripts that combine prefabs with each of the ground tiles, so would rather avoid that for now.
Are there other option to smoothen the transition between two box colliders?