2D Player Colliding with Ground - Tile Based

Hello everyone!

I am currently working on my first Unity 2D prototype and am having a slight issue.

I did a fair amount of googling and found quite a few different threads but can’t seem to find anything specifically covering what I am experiencing!

So I built a really simple level with a 3rd party tile map creator. That works perfect! Everything tile on the ground has a box collider and my player uses a RigidBody2D as well as a circle collider on his feet.

I coded up a simple player controller using the rigidbodies Velocity for movement, and AddForce for simple jumping and falling when not grounded. I referenced a Unity tutorial for this movement and jumping.

All of that works perfectly! My slight issue now is, and it is very slight… when I move the player will randomly ‘chop’ well the camera will, since it follows the player. It seems like the circle collider randomly dips down a few pixels and giving a very unpleasant choppiness effect or like the player weighs a ton causing slight camera shaking. This is undesirable for the project! I would like it to be as smooth as possible.

I am sure it has something to do inherently with leveraging the Physics2D engine instead of just throwing some magic numbers in and moving the transforms with Time.DeltaTime, which in the past on other platforms was my standard 2D movement work flow. I decided to go Physics2D for this to gain experience with it and also allow me to do more interesting things, which otherwise would have to be faked moving transforms and using magic numbers.

And something else which I find interesting, if I use a Polygon or Box collider on the player, he will randomly get stuck when moving. So my guess is this has something to do with all of the box colliders on the ground and there is some kind of conflict within the Physics2D engine itself.

Where speed is a floating point variable of 10, this is all I am doing to move my player.

function FixedUpdate()
{
    //controls
    moveX = Input.GetAxis("Horizontal");
    
    //physics
    rb.velocity = new Vector2(moveX * speed, rb.velocity.y);
}

As always, thank you guys for any input and or suggestions!! :smile:

EDIT:

It looks like I was able to get rid of this issue, by removing all of the box colliders on the ground tiles, and creating one box collider for all of the ground surfaces. Not really how I wanted to do it, since there will be many surfaces in future levels, but this seems to have solved the sudden and random choppiness for now!

Still looking for others input on the matter!

Thanks again guys!