- Home /
Physic Materials friction situation...
Hi there, im trying to make a sphere with a rigidbody slows down when rolling over a plane, tryed every combination of static and dynamic friction, directions and didn't got any result, someone can help? Im trying to simulate something like a pool table...
Thanks in advance!
Answer by SarperS · Dec 22, 2010 at 07:36 PM
You can try setting a higher angular drag for the rigidbody of your sphere and also set a angular sleep threshold using Physics.sleepAngularVelocity
so your rigidbody may stop after the angular velocity goes below a limit.
Answer by Jason B · Dec 22, 2010 at 07:33 PM
One of my first projects was a game like Marble Madness, and I experienced a lot of this same issue and spent probably 10 hours total making the movement feel perfect.
The ultimate fix for me was to actually go into the rigidbody's properties and change the angular drag to a higher value so its rotation would slow down quicker. After you do that, make sure the friction values are fairly high so that the ball will actually roll (with low friction, the ball ends up sliding instead of rolling, like it's made of ice and creating an entirely different issue). You may also want to very slightly raise the regular drag, but be very careful as this creates a semi-unrealistic effect if you make it too high (for instance, an airborne ball almost stops dead in the air and falls straight down).
Finally, make sure you apply a texture to the ball so you can visually note how it's moving and whether its movement is entirely driven by rolling (which it should be for the most part).
This would be that more ideal approach that I completely missed. Good work, sir!
Answer by Eric5h5 · Dec 22, 2010 at 07:28 PM
A mathematically perfect sphere on a mathematically perfect plane will have an infinitesimally small point of contact, so friction won't do anything. You can use OnCollisionStay to manually slow it down instead.
$$anonymous$$y answer is basically the same as this. Yay consistency! But the reason I didn't suggest OnCollisionStay is that is is passed a Collision ins$$anonymous$$d of a Collider, and I'd rather work with the Collider directly.
@$$anonymous$$ickydtron: You can always access the collider through the collision variable easily enough; adding triggers seems like unnecessary complexity for no gain.
No point of disagreement here on the fact that a perfect sphere has quite literally a single point of contact, but I believe that given the physics engine's default values of penetration, spheres end up colliding on a very small circle rather than a point. Regardless, I've noticed that the friction does change whether the ball moves by sliding or rolling, though it doesn't in and of itself make the ball move faster or slower. Once you mix the friction with some angular drag, that's when the magic happens. :)
@Eric: That is a good point that I will try to remember in the future. (Going for solutions with unnecessary complexity is one of my biggest weaknesses). You are absolutely correct that OnCollisionStay would be a better choice.