Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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 MrMika · Aug 05, 2014 at 09:42 PM · 2dcolliderspritepixelgaps

How to eliminate gaps between 2d colliders?

Hello!

This is something that other people asked and got an answer, but these solutions are not good so there must be another way, because if there isn't, i think it should be changed in the next version, somehow, so it works in all projects.

Every time i try to use colliders, in my pixel art project, there are always gaps between objects. All the sprites use 100 pixels per unit and i use a RigidBody2D and a 2d box collider on the object(i tried with different colliders and i always get the same result). Here's what happens:

2D Gap

(Two different sprites with box colliders with a big gap between them)

I know that there are some ways of "fixing" it but they cause other problems. Here are some of the solutions i've found and, in my opinion, their flaws:

  • Smaller colliders - This might not work in some cases, i have to test and tweak the values a lot (because there are some advanced pixel art sprites) and it doesn't seem right to do it this way

  • Scale the sprites up - This can be done by decreasing the pixels per unit value but that causes the physics to act badly, so i would have to change the physics values as well

I could use one of these but i would have to change a lot of things to make it work. So my question is, is there a better way of doing this without getting gaps between 2d colliders?

As i said before, if there isn't, i think it would be nice to be able to change the "Min Penetration For Penalty" of the 2d collisions just like in the 3d physics manager (i'm not sure if this would work as i think it would but it's just a suggestion).

2dgap.png (6.6 kB)
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

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by MrMika · Aug 27, 2014 at 03:09 PM

Since i couldn't get any other solution and there is a suggestion that mentions the Min Penetration For Penalty for Physics2D (here), i changed my mind and i will have to use a lower pixel per unit value (1 pixel per unit), while this feature is not in Unity, and to fix the gravity problems i changed the value in the Physics2D settings from -9.81 to -981 and i haven't got any problem.

Comment
Add comment · 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
0

Answer by longkeng · Sep 02, 2014 at 06:08 AM

You can find the answer here

http://forum.unity3d.com/threads/boxcollider2d-colliding-with-edgecollider2d.223054/#post-1488478

Comment
Add comment · Show 1 · 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 MrMika · Sep 02, 2014 at 02:28 PM 0
Share

That doesn't work.

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.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Pixel-perfect custom sprite pivot point 2 Answers

Creation of Edge Colliders at Runtime 0 Answers

How to recalculate collider bounds when i animate a 2d sprite? 1 Answer

Unity2D: Renderer off/ on by triggers 0 Answers

How to make an object follow along the shape of another? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges