How to fix "bumping" motion when platforms (colliders) do not perfectly match height wise

I am having a hard time getting around this, I have a generated runner type situation where certain prefabs don't align perfectly so the character has a bit of a bump when moving along a seemingly straight path.

I have tried re-parenting the prefabs in question and changing their y transform, but this gets me nowhere.
Adjusting their height will fix when the player runs onto that platform, but then when they leave that platform there will be a slight bump.

I have tried messing around with the default contact offset, but I am pretty sure that only has to do with functions being called and physics reactions happening as a result of contacts. I am wondering how to smooth out this issue, as I have tried meticulously changing the height of the objects. This is a 3D project.

If the prefabs are like 3D blocks, then the issue happens because the character collides with the vertical face of the mesh. The possible workarounds I can think of are:

  • Remove the vertical faces of the blocks at the sides that are intended to be connected with another prefab.
  • Use a "floating" character that is not directly in contact with the floor, but a bit above it. This video explains how that solution works: https://www.youtube.com/watch?v=qdskE8PJy6Q

My problems is that in my game te player runs along tiles which are separate objects (and they have to be)
Although they are identical and at the same height, I suppose the player still collides with these vertical faces.

Then the “floating” character approach described in the video would solve the problem as it wouldn’t collide with the vertical faces.

So i will have to apply a constant force in the y direction of my player to make them float, but eliminate this force when they jump? Wont this produce weird mechanics?

Here is an image to give you some context

8934477--1225044--AdMob_SS_4.jpg

That's exactly what regular collisions do: apply an upwards force to the rigidbody when it's in contact with the floor, but stop applying it when it's not in contact. I don't think this will produce any weird results.

1 Like