I've made a character design and added Rigidbody 2D and Box Collider 2D to it but when I put it on top of the ground which is in tiles in a tilemap it floats on top i.e. the tilemap consists of a hill going up then down but when I put it on the ground it goes up again in a position level to the peak of the hill
and even on top of hill it floats a little above the grid line

  • \$\begingroup\$ Can you please show us a screenshot with the green selection outline around the colliders on the character and tilemap, so we can see their extents? A screenshot of your character's inspector so we can see how you've configured your body or other scripts would help too. \$\endgroup\$ – DMGregory Jun 9 '20 at 9:25
  • \$\begingroup\$ @DMGregory srry didnt understand. And as for inspector, I'll show just a min \$\endgroup\$ – Omer Hijazi Jun 9 '20 at 11:27
  • \$\begingroup\$ Click on your character in the scene view. Make sure its collider component is expanded in the Inspector window. See the green box outline around your character in the scene view, representing your collider shape? That's what we need to see. You can do the same thing when selecting your tilemap to show the green edges of its colliders. \$\endgroup\$ – DMGregory Jun 9 '20 at 11:28
  • \$\begingroup\$ @DMGregory thx a lot (how?) cuz when you told me about the green lines I realized they could be resized so I created 5 box colliders one for each unleveled surface i.e. first flat ground then slope then top of hill then downslope then ground again \$\endgroup\$ – Omer Hijazi Jun 9 '20 at 17:57
  • \$\begingroup\$ If you've solved your problem, please post your solution as an Answer below. \$\endgroup\$ – DMGregory Jun 10 '20 at 10:16

From an initial look (Thank you for providing pictures), it looks like there is a collider here that we haven't seen yet.

I would recommend:

  • Check that the collider for the player is accurate
  • Check that the colliders for the ground are accurate
  • Give your scene a check to make sure there are no other colliders messing with things.


This wasn't the answer, as is evident.

The next thing you should try is checking that both your coin and player are set to be affected by gravity. This can be found in the rigidbody settings.

  • \$\begingroup\$ Oh no there are only 3 colliders 1 for tilemap 1 for character and 1 for that coin but it doesnt matter and 2 rigid bodies on coin and character <br> btw even the coin has same issue as you can see \$\endgroup\$ – Omer Hijazi Jun 9 '20 at 8:59
  • \$\begingroup\$ My answer isn't correct and hasn't solved your solution, so I would unselect it as the accepted answer \$\endgroup\$ – Natalo77 Jun 10 '20 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.