# Friction question

This topic is 4710 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi I'm making a small demo something like 1942 the top down plane game. I'm not making the physics completely realistic but i'm still using the standard equations just to show that I can implement these. So i'm using the following variables and using them as 2d vectors. Displacement = s Inital Velocity = u Velocity = v Acceleration = a Time = t Force = F Mass = m So say the keypad up key is pressed the program will apply a force of x in the up direction of the screen to the plane. Then use F=ma to get the acceleration. Then plug this into s = ut + 1/2at^2 to get the displacement of the plane in the time interval of the frame. The problem lies in how I should apply air resistance or friction to make the plane slow down and stop gradually. As it is it just keeps going until I press down to put a different force on the plane or it hits the edge of the screen. All help is greatly appreciated. Cheers Neil

##### Share on other sites
You apply a force in the reverse direction, and then use the netforce or whatever to get your a.. However, I'm not sure that's a good idea to use your second formula.. It'll work wierd when you don't use constant acceleration I think..

Friction between surfaces is the normal force * the friction coefficient or whatever.. Air resistanse is a bit more complicated.. I don't remember the formula.. But you'd still substract this force from the F you use right now to get acceleration..

##### Share on other sites
Air resistance at high speeds is proportional to velocity2 (i.e the faster you go, the greater the force).

You could calculate a resistive force FR = Av2, where A is some constant. However an easier way would just be to directly modify the velocity each frame.
i.e

update(dt){  a = F/m  v = 0.99*v + a*dt  s = v*dt}

##### Share on other sites
So if I added in a statement at the Force calculation bit say

if(v > 0)
{
Force_Resistance = (A)*(v^2) ;
Force_Resistance *= (-1) ; //To make the force opposite to the velocity
}

Then sum up the total forces to get a net force and work out the acceleration from there and plug it into the velocity/displacement equations.

##### Share on other sites
Yep that should work. If it doesn't work too well, just fallback onto the other method I mentioned..

Thanks

Much appreciated

You're welcome.

• 9
• 23
• 10
• 19