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
11
Question by AlienHook · Sep 21, 2014 at 07:02 PM · 2dcharactercontrollerrigidbody2dplatformer

2D character controller getting stuck on walls

I followed this tutorial: 2D Character Controllers to make a character for a 2D platformer. But I noticed one problem: if I'm pressing the directional key towards a wall while the character is in the air, they will stick to the wall and stop falling. The character controller knows that it's not grounded, so I don't know what the problem is. How do I work around this?

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 Slev · Sep 21, 2014 at 07:05 PM 0
Share

Are you sure it knows it's not grounded (logging?) It's possible the bottom is clipping in to the wall.

5 Replies

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

Answer by satyagames · Oct 01, 2014 at 05:37 PM

Apply a "slippery" physics material to the character's box collider.

i.e, Assets > Create > PhysicsMaterial2D and simply changed the friction variable to 0 from the inspector and apply to walls as well as character.

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 eric-914 · Dec 18, 2014 at 10:43 PM 1
Share

I think I understand why the walls need to be slippery (but not floors), but why does the character also have to be slippery?

UPDATE: Seems I only need to update the character collider box to no friction, not the walls. Opposite of what I thought.

avatar image MrSoad · Dec 18, 2014 at 10:47 PM 1
Share

Physical materials can be setup in a way that allows the character to take the $$anonymous$$imum friction values of the objects that it is in contact with, so when in contact with the wall it will react with very low friction, but when in contact with the floor it will not react with low friction(as if they both have a high friction then the $$anonymous$$imum(smallest) value of the two is still big). Hope you can understand my explanation :)

avatar image rogerbif · Sep 06, 2018 at 03:42 PM 0
Share

Thanks, this help me in my project.

avatar image
4

Answer by SparrowHawk666 · Mar 13, 2016 at 03:32 PM

add box colider then click 'Used by Effector' add a component 'platform effector2d' untick 'one way' and if you are using Gronded with ground layer then and the items to this layer...

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 cyberspacecat_ · Oct 13, 2018 at 09:03 PM 0
Share

This worked well for me.

I'd like to add that my specific problem was my character getting hung up on corners (as it was technically touching the top collider that had friction on it) and trying to compensate by giving the wall physics material more corner space meant sliding off the platforms in a frustrating way.

The way I finally fixed this while using SparrowHawk's method was to increase the "Side Arc" value on the Platform Effector to around 75 and my character was treating the corners more correctly.

avatar image
0

Answer by SparrowHawk666 · Mar 13, 2016 at 03:32 PM

i.e, Assets > Create > PhysicsMaterial2D and simply changed the friction variable to 0 from the inspector and apply to walls ONLY,

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 unity_EEHU-BnWOgm7Tg · Mar 26, 2018 at 10:34 AM 0
Share

how do I do that is only to walls?

avatar image
0

Answer by orrinjones · May 23, 2017 at 06:35 AM

This as been a while but I will still add my input for anyone else who might be having the same issue. While the above method might work. You may alternative adjust the skin width of the character controller. Hope that helps

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 StudioZooka · Jan 27 at 11:13 PM

https://www.youtube.com/watch?v=eJik78bWSg0

This tutorial fixed the issue for me

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

9 People are following this question.

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

Related Questions

Moving platform player bounce when moving down 1 Answer

How to make character stop at wall? 1 Answer

Character clips into the ground in 2D platformer 0 Answers

Rigidbody2D velocity changes when moving through a platform collider. 1 Answer

How to make character move up walls and along the ceiling? 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