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
0
Question by turowskipaul · Feb 26, 2019 at 04:03 AM · physics2dfriction

friction different on ceiling in zero gravity 2D

I have a 2D scene in which all gravity is zero (in both Physics and Physics 2D settings) and a player with a Rigidbody 2D which has the Gravity Scale set to 0. I have a script which imposes arbitrary gravitational forces on the player (e.g. towards the ground, the ceiling, the walls). The force is uniform and gravity really is zero; when I turn off the gravity script the Rigidbody floats with no other forces imposed on it.

The problem is that when the player is moved along the surfaces of the room by adding force to the Rigidbody, there is clearly a difference between the speed at which it moves on the ground and the speed at which it moves on the ceiling and walls. The only reason I can think of to explain this is that there seems to be less friction on the ceiling than on the ground.

I've tried creating a Physics Material and using different settings for that and I've tried different Friction Types in Project Settings > Physics (there doesn't seem to be a Friction Type setting specifically for 2D) but I get the same results no matter what.

Has anyone else encountered this before? Is there some other place in which friction is set for 2D Physics that takes Y position into account?

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

3 Replies

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

Answer by turowskipaul · Mar 03, 2019 at 01:42 AM

After some more debugging, I found the problem:

 mRigidbody.AddRelativeForce(moveVector * moveForce - mRigidbody.velocity);

In attempting to limit the player's speed, I was subtracting velocity in the world from the relative force applied (which of course worked fine when I was still working in a purely top down world). Anyway thanks to all who looked at this and hope this helps someone later.

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 MSavioti · Feb 26, 2019 at 04:14 AM

Create a Physics Material 2D, set its friction to zero and attach it to the player.

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 turowskipaul · Feb 26, 2019 at 01:29 PM

Thanks for your reply. As I mentioned, I've already created a Physics Material 2D (for both the player's Rigidbody2D and the ground's PolygonCollider2D) and tried different settings, including setting the friction to zero. Even when I do this, there is still a clearly noticeable difference in friction between when the player is on the ground vs when the player is on the ceiling. It's as if there is ice on the top of the surface but normal ground on the bottom.

A couple other points of clarification:

  • I'm rotating the player so it's always contacting the ground at the same point (i.e. the bottom side of a CapsuleCollider2D)

  • I'm using one continuous surface for the ground—a PhysicsCollider2D that is created around a spline—so it's all the same ground material

I've attached an image to further illustrate. There's a Debug ray being drawn below the player showing the force of gravity. This is always perpendicular to the underlying spline.

alt text


screen-shot-2019-02-26-at-12313-pm.png (510.3 kB)
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 turowskipaul · Feb 27, 2019 at 12:18 AM 0
Share

Update: been testing this more and still stumped, but I thought I'd share what I've done in case it helps.

I made the ground shape symmetrical: same behavior.

I put the player outside the shape ins$$anonymous$$d of inside: no change. That is, the player has much less friction when on the bottom of the loop (i.e. upside down) than on the top. To elaborate, applying a short push while the player is on the side sends it sailing around the bottom of the curve to the other side, while it takes sustained force to move it around the top of the curve.

I thought it might have something to do with the direction of the spline (around which the Polygon Collider 2D is created) so I reversed the spline and rebuilt. Same behavior.

I also tried using different 2D collider shapes (box, circle). No luck.

I tried attaching screenshots of the Polygon Collider 2D as well as my 2D Physics settings in case I'm missing something there, but photo upload doesn't seem to be working right now. I can try uploading these later if it would be useful.

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

102 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Modify friction behavior on Physics 2D Material 1 Answer

How to make paddle influence ball motion in brickbreaker 0 Answers

Vertical wall friction when character is falling and presses into a wall? 1 Answer

Physics 2D Frictionless 1 Answer

Physics2D simulation is not taking into acount the material's Friction 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