Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by jellybit · Dec 22, 2013 at 02:38 PM · physicsphysics2d2d physicsgapsrigidbody 2d

How to avoid gaps between 2D physics objects?

Here I have a project with some 2D physics blocks (objects with a non-kinematic Rigidbody 2D component). As you can see, they have these gaps between them and the ground/other objects.

alt text

You may also be able to see from this image that I've shrunken their colliders. As I was doing this, I found that even if I could close the gap between the blocks, a gap would remain between the blocks and the ground. If I shrink the colliders enough for there not to be a gap between them and the ground, then they are inside each other.

This makes me think there's a "skin" thickness setting or something on the physics, but I can't find any for 2D physics. I've tried adjusting the mass and gravity. Neither fix it, though high gravity makes everything jitter. How can I best solve this problem? Thanks!

unity2dphysics.png (61.9 kB)
Comment
Add comment · Show 8
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 Josh707 · Dec 25, 2013 at 05:04 AM 1
Share

You can reduce the collider size on the box until it fits closer, or try changing the $$anonymous$$imum penetration distance for forces in the physics settings

avatar image jellybit · Dec 25, 2013 at 05:14 AM 0
Share

@Josh707 : You may have missed the paragraph about changing the collider size, but I've tried that I can either make it look ok on box-to-box, or box-to-ground, but not both. What I need is to be able to make it collide on the collider edge, and not on an invisible bubble. Also, I mentioned this penetration setting doesn't seem to be in 2D physics settings in my final paragraph. It is in 3D physics, but that setting does not affect 2D physics at all from what I'm able to see.

Thanks for your thoughts.

avatar image Josh707 · Dec 25, 2013 at 11:00 PM 0
Share

Ah sorry, I haven't downloaded the newest version with the 2D tools yet so I wasn't sure how different it was. It's weird that you can't get the collider size to be properly sized though, hopefully someone else can help you!

avatar image highpockets · Dec 25, 2013 at 11:53 PM 1
Share

What about if you shrink the collider on the boxes to make them good from box to box? Then since you only have a problem with the ground, adjust the ground collider to find your happy place. $$anonymous$$aybe you've already done/thought of this

avatar image jellybit · Dec 26, 2013 at 12:41 AM 0
Share

@highpockets I may end up having to shrink the ground collider, but since I'm using different pieces of ground of different sizes to build levels, that's pretty annoying to have to deal with on a larger scale. Also, this skin thickness issue makes it impossible to set collision with the player to what I actually want it to be for both physics and non-physics objects. For instance, I make the collision smaller for non-physics objects (which my player is), and that fixes the gap between them and physics objects. However, then the player sinks into other non-physics objects.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Diego-Machado098 · Feb 11, 2016 at 01:49 PM

Just in case someone stumble upon this: Decrease the 'Pixels per Unit' property on your textures. This will make Unity show sprites bigger and those little gaps we'll be filled/unnoticeable.

Don't forget to adjust the gravity accordingly. (menu: Edit > Project Settings > Physics 2D)

I'm using Pixel Per Unit: 1 and Gravity: -981

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 Reispfannenfresser · Mar 03, 2020 at 03:59 PM

Just in case some more people stumble upon this:

The gap is determined by this value. Changing it to 0.0001 makes the gap unnoticeable, but may also cause some collision wonkiness.

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

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

24 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

Related Questions

How can i make a ragdoll stickman controller? 0 Answers

Is there a way to create water like behavior. 0 Answers

Physics. What is interpolate, extrapolate, discrete, continuous? 3 Answers

Get point on surface of Collider2D from inside collider. 1 Answer

Deterministic physics options 2 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