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 question was closed Oct 22, 2012 at 05:55 AM by Fattie for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Ghopper21 · Oct 21, 2012 at 05:33 PM · rigidbody2d-physicsphysicmaterialbounciness

How do I get this 2D ball/wall bounce working?

I've got a top-down 2D scene, with X to the right, Y up, and Z (unused) into the screen.

In the scene are:

  1. A ball object with a capsule collider with Unity's standard bouncy material and rigidbody with Z position frozen and X and Y rotation frozen and gravity off, and a script that uses rigibody.AddForce to start movement along the X axis to the right towards the wall

  2. A wall object with a box collider and a rigidbody with gravity off

In the Physics settings, I've set the bounce threshold to 0.

What happens is the ball properly moves towards the wall but it doesn't bounce off. It collides and goes the other way, but much slower without any bounce, with the same behavior as when there's no bouncy material. It's as if the bouncy material doesn't exist. What am doing wrong?

Comment
Add comment · Show 5
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 Ghopper21 · Oct 21, 2012 at 07:03 PM 0
Share

@Fattie - thanks, but yes, there's a box collider (non-trigger) on the wall.

avatar image Ghopper21 · Oct 21, 2012 at 07:22 PM 0
Share

@Fattie - unfortunately still doesn't work. I already had the Bouncy physic material on the ball's capsule collider. I added it to the wall's box collider. No change in behavior...

avatar image Ghopper21 · Oct 21, 2012 at 07:54 PM 0
Share

@Fattie - I figured it out! What I was doing (and should have mentioned in my question) was that I had the wall frozen. So the energy from the ball was transferring to the wall, leaving little left for the ball. What works is either (1) not have a rigidbody on the wall at all or (2) make the rigidball NOT frozen but with a very high mass, so that the ball bounces off. Again, thanks for your help -- I've checked out Unity Gems and it looks excellent -- more programmer-centric than many Unity resources -- very much hope to see that site develop.

avatar image RedNivar · Jun 13, 2018 at 01:12 PM 0
Share

Watch this tutorial now: https://youtu.be/oqD29T7$$anonymous$$LqU

It can help you to create your required physics.

avatar image oguzkagan · May 17, 2020 at 12:11 PM 0
Share

I found the solution in this video: https://youtu.be/RoZG5RARGF0

2 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by Ghopper21 · Oct 21, 2012 at 07:55 PM

I figured it out! What I was doing (and should have mentioned in my question) was that I had the wall frozen. So the energy from the ball was transferring to the wall, leaving little left for the ball. What works is either (1) not have a rigidbody on the wall at all or (2) make the rigidball NOT frozen but with a very high mass, so that the ball bounces off.

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 LeakySink · Oct 21, 2012 at 10:21 PM

I wouldn't set the bounce threshold to 0, that might be your issue. You could also try adding the bounciness material to the wall object.

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 oguzkagan · May 17, 2020 at 12:12 PM 0
Share

i found the solution in this video: https://youtu.be/RoZG5RARGF0

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Player sticks to right side of platform after jumping in it 1 Answer

Rigidbody slightly falls into boxcollider and gets pushed out 0 Answers

2D Physics: How to have a character "grab" onto wall with hand 0 Answers

Glider physics with AddForce 2D 1 Answer

Why is there no Rigidbody2D.SweepTest() ? 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