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
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.
Thanks. Do you need a script for it?
Sorry. What do you mean a script for it?
Answer by hellcats
May 24, 2011 at 04:55 PM
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.
Answer by Muzz5
May 24, 2011 at 04:38 PM
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.
Answer by Meltdown
May 24, 2011 at 04:47 PM
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.
Answer by poncho
May 24, 2011 at 04:56 PM
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)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
5 People are following this question.
Question on Vector3.Reflect()
Advice for Intersecting Colliders
A node in a childnode?
Physics ignore layer collision script error
Detecting collision and fixing position odd behaviour.