- Home /
Rigidbody2d Floating Above Ground
Hi! I'm new to Unity and I am trying to get basic 2d platformer mechanics working. However, for some reason, when using a rigidbody2d, the character floats above the ground. I can't figure out why this is happening. If you've had this problem before, how did you fix it?
This is how it looks without the rigidbody2d:
And then once you add the rigidbody2d, he floats:
Answer by skopusnik · Mar 19, 2021 at 03:28 PM
For anyone with this problem, go to Edit / Project settings / Physics2D and change Default contact offset closer to 0. like 0.001 and it will fix this problem.
Answer by Sxythe · Mar 02, 2020 at 03:56 PM
Check and adjust your colliders of your sprite and ground, they might slightly be bigger
Answer by enerology · May 25, 2020 at 05:34 PM
A simple solution is to shift your collider2d up to make up for that distance gained from the ground. This will cause your sprite to be overall slightly lower and fix the gap.
Answer by mintyvoid · Feb 28 at 08:04 PM
I had this issue and then realized my background object had a collider on it, no idea when/how- must've done it by mistake.
Your answer
Follow this Question
Related Questions
2D Sprite Fillup without using UI 1 Answer
Bluring sprites without editing images directly 0 Answers
How do i Flip a 2d game object that is facing towards the cursor 0 Answers
How to fix random lines that appear in my background. 1 Answer
2D Sprite drifting down, otherwise passes through walls - how do I fix these issues? 0 Answers