Sign in to follow this  
NotTheCommonDose

[Solved] Friction when object is on the ground

Recommended Posts

So, I've been moving pretty quickly through my physics problems. I have a new one though involving friction. EDIT: the link used to redirect is down for the moment so I'll post the problem here. Here is the problem.. Using this drag: k1=.09; k2=.01; drag=(k1*accAccumX)+ (k2*(accAccumX*Math.abs(accAccumX))); accAccumX-=drag; grandVelX=accAccumX; my objects will reach a maximum velocity and slow down accordingly. However, they don’t slow down appropriately when on the ground. What I need to devise is a friction when the player is on the ground. This way he doesn’t float along until drag is enough to stop him, but rather stops the player quickly when the controls are released. Like in real life, friction will stop you quickly instead of letting you drag on. Then I can change the value when the player is on ice, or sand, or just grass and have the appropriate effect. I’ve been looking into it and I can’t find exactly what I am looking for. Possible solutions: 1. increase the drag (or create a new one) when the player is on the ground, although this isn’t necessarily the best way. 2. Create a new variable ‘friction’ and do something like this: if (player is on ground) velocity = velocity * friction; This doesn’t seem right either. Any thoughts? [Edited by - NotTheCommonDose on July 2, 2009 4:19:32 AM]

Share this post


Link to post
Share on other sites
Friction is a force. In general:
Fμ = μFN

Where FN is the "normal force." A good way to look at this: say you have an object experiencing some force F1. However, the object is against some surface which prevents its movement in that direction. What you must do to prevent the object from slipping through is add another force F2 in the direction of the surface's normal. This is the normal force.

If you have an object on flat ground, experiencing the force of gravity straight downward, then the normal force will be of an equal magnitude, but straight up; therefore preventing the object from slipping through the floor.

The constant μ is the coefficient of friction. There are many real world values cataloged endlessly - but just use whatever works for you.

Note also that the actual force of friction will be applied in the direction opposite of motion.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this