Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About sgb27

  • Rank
  1. sgb27

    Coulomb friction in a closed form

    Ff = u * Fn * V / |V| Where V is the relative velocity between the two points in contact. Assumption here is that velocity has no component normal to the contact point. What I usually do in my code is to work out what force (in the V direction) would bring the relative velocity to zero, then limit it to u*Fn. This prevents the body reversing direction during a time step, keeps it at rest if it is at rest, and limits the maximum force to the correct value based on the coefficient of friction. I don't think you can solve these sorts of things very easily with differential equations, unless you split up the time into periods where the friction force is constant or linear.
  2. sgb27

    Realistic Car help.

    Quote:Original post by monp I was going to program a car setting up a random horsepower number and torque lbs,among other things. What you need to decide is the torque output of the engine at every rpm - this is usually shown in the form of a chart of torque against rpm. I would just find a stock graph from any car and then scale it by a random amount to get whatever maximum torque you require. Horsepower is calculated from the torque, Power = torque * engine speed. If you're using non-metric units you'll need some scaling factor in there too. I recommend you use all metric SI units internally though (watts, newton metres, radians per second, metres per second) and then scale to more familiar units just for input/output. Quote: But I realized I do not know that much about cars to calculate the cars max speed, acceleration, and how long it would take to reach its potential,how much gas it would use going a certain speed. Does anyone know the calculations to figure it out? The easiest way to work out all those is to run a simulation. You keep track of the vehicle speed at each time-step, and then at each step work out the following (in this order): 1) The gear the car should be in (either worked out automatically or based on user input) 2) The engine speed (rpms) from the car speed and gear 3) How much torque the engine is generating at this rpms (from your graph above, plus optional user input for % of throttle) 4) How much forward force this generates on the car (depends on gear ratios and tyre size) 5) How much air drag there is (depends on some constant (try 0.5) times vehicle speed squared) 6) The acceleration of the car (depends on 4 and 5 and the mass of the car) 7) The new speed of the car (old speed + acceleration * time step) That is very simple, but it's a good starting point, and if you use a small enough time-step (eg 0.01 seconds) you should get pretty accurate results. Edit: For fuel use, a good first approximation would be to assume the rate of use is proportional to the engine output power.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!