[Solved] Friction when object is on the ground

Started by
3 comments, last by erissian 14 years, 9 months ago
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]
Advertisement
EDIT: I posted the question here, since the link is down.
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.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
Worked like a charm. Thank you. :D
Quote:Original post by NotTheCommonDose
Worked like a charm. Thank you. :D


Fantastic.
We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)

This topic is closed to new replies.

Advertisement