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 /
  • Help Room /
avatar image
0
Question by ROMgame · Sep 15, 2015 at 04:12 PM · physicsrigidbodyunity 2drigidbody2dphysics2d

Collision sticking?

I'm currently building a game where the player can "flick" between walls - sticking to them on collision. So when the game starts the player is stuck to the wall on the left, they flick right and their character jumps to a wall on the right, then they flick left and it jumps to the wall in the middle. This is illustrated in the below diagram.

alt text

When the player jumps I apply some force to its rigid body, the problem is that for 1-2 frames after the jump it still thinks its colliding with the wall its jumping from which causes it to "re-stick" to the wall (it sticks because touching the wall reduces the objects velocity to 0 and gravity is disabled in the game).

One solution would be to say "after a jump then temporarily ignore the wall that you're jumping from". The problem with that is if you imagine you're attached to the middle wall, to the right, and you attempt to jump left then you want to keep sticking to the wall - you want it to reset your velocity to 0. That could be solved by recasting or using the contact points to ensure that the player never tries to jump "into an object" (like the above case) but that becomes pretty ineffective where colliders are odd shapes or have holes in them.

Any help would be much appreciated! This is really causing me some problems!

Oh - as a quick side note - it's not caused by the colliders physics materials - they have 0 friciton.

test.png (2.6 kB)
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 cjdev · Sep 15, 2015 at 07:54 PM

You could try using the collision normal to 'push' your player away from the wall collider a small amount before applying the new force so that the next frames didn't register a collision. A translation in the direction of the collision normal using Collision contacts (collision.contacts[0].normal) would work for that.

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

28 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

Related Questions

RigidBody becomes awake without a collision 1 Answer

Can I rotate a hinge joint where the angle limits aren't working?,Can I rotate a hinge joint, to minimize its rotation when angle limits aren't working? 1 Answer

Adding force to a rigidbody opposite to the direction of a rotating weapon 0 Answers

Rigidbody rotate velocity 0 Answers

How to move a Rigidbody2D along another Rigidbody2D 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