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 /
avatar image
2
Question by Joncom · Mar 06, 2015 at 04:48 PM · 2dcollisionrigidbody2dboxcollider2dpong

2D Pong Ball Not Reflecting Off Walls "Exactly"

Hi. New to Unity. Making Pong. Here's a GIF of the problem I'm facing:

Problem Animation

As you can see, when the ball hits a wall at a certain angle, it no longer reflects off.

The ball has a Rigidbody2D and a BoxCollider2D with a material that's bounciness==1 and friction==0`.

The walls are made up of BoxCollider2D's.

So far as I can tell, this "lack of bounciness" is normal behavior for such angles.

However, is there any way to get around this?

Perhaps manually messing with the ball's velocity via it's OnCollisionEnter2D method?

PS - My source code can be found here.

Edit: Looks like this guy had the same issue, but unfortunately didn't find a solution.

Comment
Add comment · Show 3
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 meat5000 ♦ · Mar 06, 2015 at 03:29 PM 1
Share

What happens with friction = 1?

avatar image d2 · Mar 06, 2015 at 05:57 PM 0
Share

try adding a bouncing material to the walls

avatar image Joncom · Mar 06, 2015 at 07:29 PM 0
Share

@meat5000: With friction==1: http://i.imgur.com/ovsA9tV.gif

@d2: Tried adding a material to the walls (`friction==0` and bounciness==1). It had no observable effect.

1 Reply

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

Answer by meat5000 · Mar 07, 2015 at 02:47 AM

Lower your Velocity Threshold to 0.1

Project Settings -> Physics2D

Described as "Any collisions with a relative linear velocity below this threshold will be treated as in-elastic"

alt text


animation-0.gif (429.7 kB)
Comment
Add comment · Show 2 · 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 Joncom · Mar 08, 2015 at 06:17 AM 0
Share

Awesome! Thank you :)

avatar image retr0rockit · Jul 04, 2018 at 12:23 AM 0
Share

Agree, just awesome! Fixed this issue across the top of my court with the simple handball game I was developing as my first unity project. Thanks!

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Character slows down when running against a wall (2D) 1 Answer

My RigidBody2D+BoxCollider2D is getting stuck on corners 1 Answer

Rigidbody2d getting stuck when moving horizontally at random points! Can't figure it out :( 1 Answer

Collision of child is detected as collision of parent with Rigidbody2D 0 Answers

How to select the trigger layer on a Box Collider 2D 2 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