x


How to make realistic ball bounce

Hi

I am new to unity, I have created a new scene with a sphere object where I set a rigid body with it and set the material to bouncy. While the ball do drop and bounce, it just keep bounce at same position and it never stops.

Is there any default unity setting I can use to make the ball bounce more realistically, as it should not bounce at same point and should stop eventually.

Thank you so much

more ▼

asked May 24, 2011 at 04:28 PM

mochatony gravatar image

mochatony
37 23 17 20

I like Muzz5's ideas. Consider also Unity is probably treating it with the theoretical bounce which means it will never stop due to the face that there is no wind resistance, etc... So like Muzz5 said add random rotation to the ball and fiddle with a value that perhaps changes the amount the ball bounces after each bounce so it will look as if it is bouncing less and less each time.

May 24, 2011 at 04:47 PM HHameline

Thanks. Do you need a script for it?

May 24, 2011 at 04:58 PM Muzz5

Sorry. What do you mean a script for it?

May 26, 2011 at 02:10 AM mochatony
(comments are locked)
10|3000 characters needed characters left

4 answers: sort voted first

Change the material "bounciness" parameter which says how much energy is conserved by each bounce. A value of 1 means no energy loss (and therefore it always returns to the same height). A value of 0 means total energy loss, and it will just stop when it hits the floor.

You could also use OnCollisionEnter and Rigidbody.AddForce(force, ForceMode.Impulse) to add the small pertubation mentioned in some of the other answers. An easy way to simulate a random floor is to use the Perlin noise function in the procedural examples. Perlin noise is smooth and always gives the same result for the same input. So if you use the x,y or u,v location of the contact point as input, you will get the same bounce everytime you hit the same point on the ground.

more ▼

answered May 24, 2011 at 04:55 PM

hellcats gravatar image

hellcats
756 26 22 37

(comments are locked)
10|3000 characters needed characters left

Actually, if you think about it, PhysX is being accurate. If you have a ball, which is not rotating, dropping onto a perfectly flat, even floor, it will bounce in exactly the same position. But it real life, our floors are not perfectly flat and even. So you could try rotating the floor very, very slightly, adding a random movement to the ball after every bounce, or making your own floor in blender (or whatever) which is less flat. You could also try adding some rotation to the ball and see if that makes a difference. A good way to simulate a non-even floor would be using perlin noise.

more ▼

answered May 24, 2011 at 04:38 PM

Muzz5 gravatar image

Muzz5
1.3k 206 171 184

(comments are locked)
10|3000 characters needed characters left

By default rigidbodies in Unity have no 'drag'. Meaning no frictional forces are acting upon them or slowing them down.

Set the Drag value of your rigidbody to 1 to start, and you will see a more realistic bounce.

more ▼

answered May 24, 2011 at 04:47 PM

Meltdown gravatar image

Meltdown
6.4k 53 57 86

(comments are locked)
10|3000 characters needed characters left

you have at least 2 options

1- add a physic material and change the values as desired

2- dont use the unity physics and make your own (which is my case)

more ▼

answered May 24, 2011 at 04:56 PM

poncho gravatar image

poncho
1.5k 7 8 22

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x6829
x4239
x3179

asked: May 24, 2011 at 04:28 PM

Seen: 11897 times

Last Updated: May 26, 2011 at 02:10 AM