As I say in my very accurate post title,
I’m having a nice little character running pretty fast on a box collider, everything is going very fine
The thing is more box colliders are added randomly after the first one so the character can keep running and not fall.
All the boxes are the same size and have the same y position so there is no gap whatsoever between them.
Unfortunately once in a while and I can’t manage to know why, the character bumps into the junction (that doesn’t exist since there’s no gap) between two boxes…
I’m sure this is a common problem but I can’t find any answer on the forum…
Hope you can save my life
nico
If you roll the ball along the bottom (ball moves in direction you click), it will periodically jump into the air, where the colliders meet. Each 5x5 unit level chunk has a mesh collider, and meshes are dynamically generated at runtime via a Tiled level editor file.
For your case, you could modify the first box collider to extend it to include the new area. Good only if the floor has no slopes. And bring the start of the box collider forward when off screen to prevent very large colliders.
I don’t know the reason however. The physics engine just thinks the two adjacent colliders are not smoothly aligned, even though they share the same y location. Floating point error?
Yeah that’s the same problem, annoying!
I can’t do the collider trick since I’ll need to have slopes yeah… Not sure where to look, I’ve played with the rigidbody, colliders and material options without success…
The behaviour of colliding with a box when moving another one from the side is a known, by design, issue, which is explained here and won’t be fixed:
recreating colliders as a whole via code might be a better idea. EdgeColliders keep theirs in an array, so adding the top two vertices of each box would be enough.
What if it’s a 3D box collider? Nothing like a 2D edge collider only in 3D, no? I’m trying to tile up chunks of a straight road and my cars sometimes gets “stuck” between the chunks. I’m not even doing that programatically.
As long as it’s corners against corners, there is no reason why it should be any different. But a car has wheel colliders or spherical wheels doesn’t it?
in the worst case you probably should be generating MeshColliders that fit the road by code. that would be the equivalent to the EdgeCollider2D.