Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 GarbagePile · Jul 01, 2016 at 07:19 AM · rigidbody2dphysics2dplatformerboxcollider2doverlap

2D Box Colliders Overlapping On Collision

I am attempting to make a 2D platformer in Unity, but have run into a problem with the physics. When my character jumps and lands, its Box Collider 2D overlaps with the ground's Box Collider 2D before being pushed out, creating an unwanted bounce effect. The amount of frames this overlapping occurs in depends on the velocity of the character, but I am unable to get rid of it entirely. I have seen similar issues reported when researching this problem, but I cannot find a concrete answer that works for me.

I've tried setting the Collision Detection of Rigibody 2Ds to "continuous", and adjusting several of the Physics2D Settings, including "Min Penetration for Penalty" and "Baumgarte Scale". Neither of these work properly. I have noticed that having the Physics2D settings set to their defaults gets rid of this problem for the most part, but causes the Box Collider 2Ds to have noticeable gaps between them on collision.

I am unsure of how to fix this problem. I want the character to touch the ground without overlapping it. Any help is appreciated.

EDIT: I have yet to find a solution to this problem all this time later, and so I'm bumping this old thread. I've tried changing all sorts of physics settings, code, etc., but nothing is working for me.

Comment
Add comment · Show 1
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 fosmark13 · Sep 03, 2016 at 05:25 AM 0
Share

hi dude, i was wondering if you found the answer to this problem ' cause i'm having exactly the same problem and the player speed is not too high... thanks!!!

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Raimi · Jun 12, 2017 at 05:57 PM

 Object.GetComponent<RigidBody2D>().isKinemetic = true;

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 shieldgenerator7 · Sep 02, 2019 at 11:42 PM 0
Share

Please explain why this would be helpful By the way, I don't believe this would solve the issue

avatar image
0

Answer by davidjohn123 · Sep 03, 2016 at 07:42 AM

limit z rotation of rigibody2d. for ground collision issue. you can use layers. i will recommend you to watch this video https://www.youtube.com/watch?v=flGbKSSUY0o&list=PLiyfvmtjWC_XmdYfXm2i1AQ3lKrEPgc9-∈dex=2

Comment
Add comment · Show 3 · 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 GarbagePile · Sep 04, 2016 at 09:00 PM 0
Share

I already have "Freeze Rotation" checked for Z.

I switched to the Physics2D.IsTouchingLayers method for ground detection as seen in the video. This seemed to di$$anonymous$$ish the amount of frames the player is stuck in the ground (I haven't seen it visibly for more than 1 frame). However, the player is still gradually pushed away from the ground before reaching its final landing position, and this is very noticeable as I am working with 8-bit-styled sprites.

If there is a way to just get rid of this bouncing effect altogether, with the player just remaining still once in contact with the ground, that's what I'd like to use.

avatar image davidjohn123 GarbagePile · Sep 07, 2016 at 06:42 AM 0
Share

yes make a physicsmaterial2D and raise the friction,then add this material to the colliders of ground..and sorry for late reply

avatar image GarbagePile davidjohn123 · Sep 08, 2016 at 01:35 AM 1
Share

But I don't want any friction on the various GameObjects in the scene.

I already have a default Physics$$anonymous$$aterial2D set with no friction or bounciness. I attempted to make 2 separate Physics$$anonymous$$aterial2Ds - one with friction for the ground and one with no friction for the player - but this didn't solve the problem.

avatar image
0

Answer by patosalas · Jun 12, 2017 at 05:39 PM

I´m having exactly the same problem right now, please let us know if you found an answer. I´m still looking for one

Comment
Add comment · Show 2 · 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 GarbagePile · Jun 12, 2017 at 09:48 PM 0
Share

Since making this thread, Unity has published a video tutorial series for creating custom 2D platformer physics rather than using Unity's built-in system. I don't fully understand the tutorial, but it basically guides you through making scripts that control the physics directly rather than relying on the built-in system. I'm checked, and this does indeed eli$$anonymous$$ate the overlap problem.

avatar image patosalas GarbagePile · Jun 14, 2017 at 09:15 AM 0
Share

Yes, you are right, I´m already studying how to program physics to avoid problems

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

8 People are following this question.

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

Related Questions

What's a good way at keeping a ball bounce around inside the scene? 1 Answer

Ball bounces at different heights when it shouldn't 0 Answers

2D Physics Problem? 1 Answer

Rigidbody2D character movement problem 0 Answers

Unity 2d Physics Collision Jumping / Glitching 0 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