• 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 4
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/oqD29T7KLqU

It can help you to create your required physics.

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 · 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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

12 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

Related Questions

Rigidbody2D.mass editable during runtime? 0 Answers

Disable bouncing effect 0 Answers

How do I fix sticking to walls while still allowing friction on the ground? 1 Answer

How can I make different physic materials on one 3d object to make different frictions and bounciness? 1 Answer

RigidbobyConstraints2D is not working in Unity 5.0.2f1 Personal Edition!! 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges