Sign in to follow this  
bapti

Friction question

Recommended Posts

bapti    122
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 this post


Link to post
Share on other sites
DvDmanDT    1941
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 this post


Link to post
Share on other sites
Kuladus    380
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 this post


Link to post
Share on other sites
bapti    122
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 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