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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by BlueChaos · Sep 02, 2014 at 04:54 AM · physicscolliderrigidbody2d

Physics Material - Character Slides Too Much

I am currently working on a 2D platformer. I am using a prefab from the AssetStore for my character (The last paragraph contains a link to the prefab). The character has a circle collider for his feet so that he can walk up slopes.

The problem I'm having is that because it is a circle collider, he also slides down any slope. I realize that I can add a Physics Material to the collider with a friction variable to stop (or at least resist) the sliding, but if I add any friction above ~0.1 the character can collide with a wall to stop himself from falling and yet 0.1 isn't even enough to stop him from sliding down slopes.

So my question is, how can I stop the character from sliding down slopes in a way that doesn't allow the player to stop himself from falling by colliding with walls?

The prefab that I'm using specifically is an asset found here, it's disk location is Sample Assets/2D/Prefabs/2D Character

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 Jeff-Rosenberg · Sep 02, 2014 at 05:05 AM

When the character is in the air, set the friction of the material to 0.

 void Update()
 {
     collider2D.sharedMaterial.friction = grounded ? groundFriction : 0f;
 }

I'm not in Unity at the moment, so I can only refer to this. It seems like only the sharedMaterial is available to be modified. In that case, make sure your character uses it's own physics material or you create one at runtime.

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 BlueChaos · Sep 02, 2014 at 04:57 PM 0
Share

But the way I check if the character is in air is if he is colliding with ANY ground, even on the side, so it will still register as grounded if he is sliding down a wall.

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

Ignore sub-colliders for center of mass in Rigidbody2d? 1 Answer

Reset Rigidbody2D rotation after collision 2 Answers

the player is flying off the ramp (collider) 1 Answer

driving game power ups 1 Answer

C# Check if Collider2D[] Doesn't contain Scripted GameObject 1 Answer


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