Advertisement

Realistic Car Acceleration?

Started by August 31, 2002 11:06 AM
19 comments, last by FlorianapoliS 22 years, 5 months ago
Original post by MisterAnderson42
quote:

Think about it. Use the current RPM to update the speed (because the engine can apply a torque which eventually becomes a force on the road). Since the engine and tires are mechanically linked (ignoring clutch and torque converter) and each turn together, you can find the new RPM of the engine given this new speed. This will be used in the next timestep to find the available torque again.



Ahhhh, its finally hit me, Thanks for putting up with me Now, Does anyone know where to get information about how much torque a car puts out at a given RPM :D.

P.S Thanks for the tip with the negative sign for Air Resistance.

[edited by - FlorianapoliS on September 3, 2002 8:37:21 PM]

[edited by - FlorianapoliS on September 3, 2002 8:57:19 PM]
Google it out. I think the graph is sometimes called "horsepower graph". It shouldn''t be difficult to find a few examples.

I easily found the graph for the Audi S4:
http://www.autospeed.com/image.html?A=0514&P=1&IMG=0514_3&REZ=hi&LOC=%2Fimages

Advertisement
Is that graph for only one gear, or is it the same through out all the gears?
It''s characteristic of the engine, so it''s the same for all the gears.

Ahhh, thanks
quote:
Original post by cultofpurplecabbage
[*quote]Air resistance = -(Speed * Speed) * Constant

as Bazee said is not entirely true.

If your car can go backwards, it will have a negative speed value so squaring this you would lose the sign..
here''s a macro for ya
SQRMAG(x) x>0? x*x : x*-x

J.


return(0);


Speed is the magnitude of the velocity. Magnitude is never negative, since it''s the positive square root of the sum of the squares of the components of the vector.

Your macro also has a few flaws... e.g.
SQRMAG( 2 + 2 ) = 8




"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Advertisement
I was just wondering if there is anyway of generating torque curves for certain engines? Because currently I would have to enter a couple of hundred values into an array manually, and it would be quite pain staking.
You could always interploate. 5-10 values with interpolation should be enough to generate something that works well for a game.
Thanks,I''ve made a little VB program that fills in the blanks when I give it values Its just that now I have another problem, I''ve got the car accelerating, but it tops at out 36km\h in 6th gear at 6500rpm?

My drag constants.

  const float CDrag = 0.4257f;const float CFric = 12.8f;  



(Ignore the corvette, its actually for the Audi S4) These are my car properties.

  	corvette.cartype.WheelBase = (float)4.4f;	corvette.cartype.GearRatio[1] = 3.500f;	corvette.cartype.GearRatio[2] = 1.889f;	corvette.cartype.GearRatio[3] = 1.230f;	corvette.cartype.GearRatio[4] = 0.967f;	corvette.cartype.GearRatio[5] = 0.806f;	corvette.cartype.GearRatio[6] = 0.684f;	corvette.cartype.Diff = 4.4f;	corvette.cartype.Mass = 2100;	corvette.cartype.WheelRadius = 0.45f;  


And my move car function:


  int MoveCar(CAR &car, float delta){	float max_torque, engine_torque, drag, friction;	max_torque = car.cartype.Torque[(int)car.rpm]; //Get max torque at a given RPM	engine_torque = max_torque * (car.throttle / 100); //Multiply it by throttle position		drive_force = engine_torque * car.cartype.GearRatio[(int)car.gear] * car.cartype.Diff * corvette.cartype.WheelRadius * 0.7f; //Calculate drive force	drag = - CDrag * car.vel * ABS(car.vel); //Calculate Drag	friction = - CFric * car.vel;	//Calcualte Friction 	car.force = drive_force + drag + friction;	//Find sum of forces acting on car	car.accel = car.force / car.cartype.Mass;	//F = m / a, to find acceleration	car.vel = car.vel + car.accel * delta;	//calculate car velocity using v = u + at	car.rpm = ((car.vel / corvette.cartype.WheelRadius) * car.cartype.GearRatio[(int)car.gear] * car.cartype.Diff * 60) / 2 * (float)PI; //Workout RPM off new speed, for next set of calculations	if (car.rpm < 1000) //Make sure RPM doesn''t go under engine idling RPM		car.rpm = 1000;	return 1;}  


If anyone could point what is causing my car to top out at such a low speed it would be a great help.
Just a thought... do you ever shift gears? I don''t see anything overtly wrong with the code you give. Maybe you could play with constants, like turn off air resistance and see how that affects things.

This topic is closed to new replies.

Advertisement