I am a beginner and I started to use Unity 5. I play with tutorials on the site and documentation. I was basically testing springs, physics materials etc.
I have a problem understanding probably a very basic thing:
I have a Sphere (Collider + Rigidbody) and a Ground (Mesh Collider).
I add force to Sphere on FixedUpdate with GetAxis method.
I added Physics material to both sphere and the ground to create a friction.
Ball slows down when I do not touch the keys (no new forces) but it never stops while moving on the ground.
I know that as only 1 point is touching the gorund friction may not be good enough, but it almost does not affect the ball after a certain period. (I print the speed of the ball (Sphere) on a GUIText so I can numerically check it there too.)
I am aware of default Sleep treshold value but it will effect everything as it is a global variable, so I can’t use that.
So, ball never sleeps.
I am aware of drag and angular drag (like the friction of Air) of Rigidbody component and they for sure work, BUT it feels like the ground is sticky and ball stops very quickly. It doesn’t look smooth and natural.
Is there something that I am missing? The only way to do this is checking the speed of the ball and making it sleep manually when it’s speed is low? Isn’t there any other method? I don’t want to do this as the world itself must live itself: I don’t want to check movement of every single object…
This is probably one of the most basic things, but I cannot understand why it doesn’t work…
No, I don’t think you’re missing anything. Dialing in the dozen or so different properties of any physical interaction to absolute perfection is not what I’d call an easy process. It definitely involves a lot of tweaking, experimentation, and perhaps a few sacrifices regarding expectations.
I remember being in a somewhat similar predicament about a year ago. Eventually I got so frustrated trying to find the various “sweet spots” I was after, I actually wrote a script which randomized the physical properties of several test objects, agitated the scene with random forces, and took down notes about which combinations of properties worked well to approach my desired results. I don’t recommend this per se, but it illustrates the degree of care and experimentation involved in really nailing down what you want.
My advice is; take every liberty with the tools available. Don’t be shy about giving things unrealistic masses or coefficients of friction, drag, etc; as long as it works, it works. Unless you’re making this for a doctoral thesis in applied physics, nobody’s going to care whether it’s realistic. Gamers just want what feels good; this boils down to “responsive” and “satisfying” - whether they realize it or not, “realistic” is pretty far down on the list.
I don’t recommend any fiddling with forced sleeping (not for this application anyway) or otherwise interfering with the kinematics. A measure that drastic should always be a last resort.