3
votes

currently I'm trying to create a life-like ping pong ball in Unity.

enter image description here

So far, no problem. I assigned a rigidbody and a sphere-collider. The sphere-collider got a material, on which I set the bounciness to 0.85 (apparently about the value a ping pong ball has on a standard solid floor).

The ball bounces fine so far, but when it is about to come to rest, that is where the problems kick in.

Initially, the ball would bounce lower and lower / faster and faster, until it finally "snapped" to the ground (missing out the last few bounces one would expect to see).

enter image description here

I read that this is because of the "bounce threshold" in the physics settings. I think the default value was 2.0, so I changed it to 0.6.

Now the ball does not get snapped to the ground, but instead won't stop bouncing at all from this last small height.

You can probably refer from this picture, the height where the balls keep bouncing on (scale of the balls should be pretty acurate to Unitys metric scale system)

enter image description here

I don't actually get why this is the case, since the bounciness is already set to 0.85, shouldn't it lower it's height by 15% every bounce?

Additional info: I already tried a few thing, give the floor a physics material too, with bounciness set to 0, adjust the friction parameters etc. but nothing seemed to have any effect on this.

How can I accomplish life-like last bounces of the ball, and let it come to rest more naturally?

Any help would be greatly appreciated.

Thanks in advance & best regards,

LilaQ

2
Did you adjust your contact offset? Default Contact Offset: Specifies distance which the collision detection system uses to generate collision contacts. The value must be positive and if set too close to zero can cause jitter. Default: 0.01. Only Colliders whose distance is less than the sum of their contact offset values will generate collision contacts. - Korgrue
Oh, good catch. Indeed I did. I just reset the physics settings (including Contact Offset back to 0.1), and the Bounce Threshold again to 0.6 (anything above will make them snap to the ground from the height you can see in the last picture, which looks really odd). But still, the balls won't come to rest, still bouncing at the same height :/ - LilaQ
One thing to consider, gamedev.stackexchange.com readers are more likely to be familiar with Unity3D. You might try asking there. - Steven Hansen
Thanks Steven Hansen I was not aware of that part of SO! - LilaQ

2 Answers

5
votes

You can try lowering the Fixed Timestep value in Edit->Project Settings->Time. This will increase the accuracy of the physics simulation. For example, with a bounce threshold of 0.6, a fixed timestep of 0.005 let my test ball eventually come to rest.

1
votes

I Exactly had this problem , but lowering the fixed timestep value does not solve my problem , I changed Drag value to 1 in rigid body componenet and my problem solved.