• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ScootchDragon · Mar 08, 2020 at 11:55 PM · 2d game2d-platformerphysics2d2d-physics2d sprites

Default Contact Offset Problems

Hi. So I am new to Unity and I am trying to make a 2d pixel platformer. However, I am having a problem. My character floats above the ground slightly, as you can see in this screenshot. alt text I tried changing the default contact offset to 0.004 and that fixed my problem. alt text But from researching a bit online, apparently this isn't a good solution as it could mess up collision? I don't really know why though. Is there a better way to solve this problem?

capture.png (1.3 kB)
capture.png (822 B)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by joemane22 · Mar 09, 2020 at 12:55 AM

My first reaction would be to edit the sprite so there is no extra pixels at the bottom.

You could also edit the sprite collider to better fit the sprite.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ScootchDragon · Mar 09, 2020 at 01:08 AM 0
Share

I've done both of these things. There are no extra pixels at the bottom of the sprite and the sprite collider fits the character perfectly. The ground collider is also pixel perfect. alt text

capture.png (7.0 kB)
avatar image joemane22 ScootchDragon · Mar 09, 2020 at 05:52 AM 0
Share

Ok so as i understand it, the default offset for unitys physics engine is what the problem is. And you are shooting for pixel perfect rendering?

avatar image joemane22 joemane22 · Mar 09, 2020 at 05:58 AM 1
Share

The only problem I could see arriving from changing that to be smaller is you may have some clipping through at higher speeds. However as long as you have interpolation set as an option for the collision detection I dont thing it would be much of an issue.

I would say keep that setting and cross that bridge if you run into an actual problem. I would definitely do some quick testing first though.

Run into some walls at high speed and such to see what it looks like.

Sorry for the simplistic answer at first, 95% of the time on here that is all it takes.

I would move to the forums for this kind of question as there are more technically skilled people that run around in there.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

169 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can anybody help me with this? Character bodying is falling apart. 0 Answers

Help Me! I want to make a pixel fairy! 1 Answer

How to create soil or sand?? 1 Answer

OnTriggerEnter2D(Collider2D other) 2 Answers

Using IgnoreLayerCollision and IgnoreCollision together 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges