Torque curves

Hello :slight_smile:

Has anybody created any “advanced” torque curves for a car engine?

“advanced” → better than the torque curve from unity examples.

I know that a simple torque curve does the work…but the problem is that the gear changes are very slow.For example 1st gear reaches the speed of 90km/h !!!

It sounds more like a transmission issue. There are formulas for engine torques to be found online. I am writing on my iphone in bed so I don’t have the energy right now to send you the formulas I use. Perhaps tomorrow if you like. Some things to consider. How high gear ratio does your first gear have? Normally between 3 and 4. How high is your final drive gear ratio? Usually between 3 and 4. What is the radius of your tires? That affects a lot. What kinds of frictions do you have in the drive line? Did you implement an rpm redline? The torque curve of an engine is cut to the right by the redline, long before it reaches zero torque. Good luck!

First of all , thx for your reply !!!

My ratios are :

//gear ratios
var gearRatios : float[] = [-2.3, 2.3, 1.78, 1.30, 1.00];
var finalDriveRatio : float = 3.4;

With the wheel radius i have a problem.I do not know if i shoud use meters or inches.

var wheelRadius : float = 0.45;
var wheelMass : float = 15.0;

var wheelRadiusInFeet : float = 0.5833; //feet
var wheelRadiusInMeters : float = 0.1778; //meters
var wheelRadiusInInches : float = 7; //inches

My wheel collider is shown in the picture.
Also if can please send me a good torque curve equation , because i can not find anything :frowning:

Finally i do not know what an rpm red line is.Perhaps you mean a delimeter?( No i do not have implemented a delimeter).

P.S.

A better torque curve is more than enough at the moment , i don’t want to bother you any further :wink:

2.3 for first gear seams a bit low.

I don’t remember if one can decide metric system or other system but I use metric system and it works fine. That would mean that 0.45f is 90 cm diameter, which are large tires. In trucks with that large tires, I think you have even higher gear ratios…

You should work those gear ratios and tire sizes to get reasonable max speed on the first gear. Also, add an rpm limiter… something like my code below. If you look at a torque/rpm chart, you will see that the right hand side of the graph is always cut of by an rpm limiter, before the torque curve goes down to zero torque.

Here is the formula I use for finding engine torque:

	public float mMaxHorsePower = 160;
	public float mMaxPowerRpm = 5000;
	public float mP1Ratio = 1.0f; // 1 for gasoline, 0.6 for indirect injection diesel, 0.87 for direct injection diesel
	public float mP2Ratio = 1.0f; // 1 for gasoline, 1.4 for indirect injection diesel, 1.13 for direct injection diesel
	public float mP3Ratio = 1.0f; // 1 for most engines
	public float mIdleRpm = 1000;
	public float mIdleThrottleFactor = 0.1f;
	public float mRedLineRpm = 6500;
	public float mRedLineThrottleFactor = 0.0f;

	/// <summary>
	/// Returns the current engine torque, based on the engine's current angular velocity of the engine and the throttle factor.
	/// </summary>
	/// <returns></returns>
	public float GetEngineTorque()
	{
		// Engine Idle Throttle
		if (mAngularVelocity <= PhysicsHelper.RpmToAngularVelocity(mIdleRpm)  mThrottleFactor < mIdleThrottleFactor)
		{
			mThrottleFactor = mIdleThrottleFactor;
		}

		// Engine Red Line
		if (mAngularVelocity >= PhysicsHelper.RpmToAngularVelocity(mRedLineRpm)  mThrottleFactor > mRedLineThrottleFactor)
		{
			mThrottleFactor = mRedLineThrottleFactor;
		}

		float maxEngineTorque;
		maxEngineTorque = GetMaxEngineTorque();
		if (maxEngineTorque < 0)
		{
			maxEngineTorque = 0;
		}
//GUIDebugger.AddDebugLine("Max Engine Torque", maxEngineTorque);
//GUIDebugger.AddDebugLine("Throttle Factor", mThrottleFactor);

		return maxEngineTorque * mThrottleFactor;
	}

	private float mHpWattConvertingConstant = 745.699872f;
	private float mEngineMaxPower;
	private float mEngineMaxPowerAngularVelocity;
	private float mP1;                              // Engine Torque and Power Equation parameter 1
	private float mP2;                              // Engine Torque and Power Equation parameter 2
	private float mP3;                              // Engine Torque and Power Equation parameter 3
	private float mThrottleFactor = 0; // 0 = no throttle, 1 = full throttle

	public float GetMaxEngineTorque()
	{
		// Engine Torque Formula
		// Te = Pe / We = P1 + P2*We + P3*We^2
		// Te = Torque Engine
		// Pe = Power Engine
		// We = Angular Velocity Engine
		// P1..P3 = Constants
		return mP1 + mP2 * mAngularVelocity + mP3 * Mathf.Pow(mAngularVelocity, 2);
	}

	private void Start()
	{
		mEngineMaxPower = mMaxHorsePower * mHpWattConvertingConstant;
		mEngineMaxPowerAngularVelocity = PhysicsHelper.RpmToAngularVelocity(mMaxPowerRpm);
		mP1 = mP1Ratio * (mEngineMaxPower / mEngineMaxPowerAngularVelocity);
		mP2 = mP2Ratio * (mEngineMaxPower / Mathf.Pow(mEngineMaxPowerAngularVelocity, 2));
		mP3 = -mP3Ratio * (mEngineMaxPower / Mathf.Pow(mEngineMaxPowerAngularVelocity, 3));
	}

Also, I don’t use the wheel colliders. I didn’t find them good enough or I did not have the patience to get them to work properly. Also, I wanted to have wheels that stop when they hit stuff. The wheel colliders are plain raycasts… but I guess they work to a certain degree…

What I did was to create colliders with configurable joints to the vehicle body. Then, they and the ground has a physic material I call “Frictionless”. After that, I implement the forward force, break force and lateral forces myself. It’s more work but you get more control.

Another thing, I was thinking about creating a custom Editor component to plot the torque/rpm-curve. I will post it if I do it… if you or anybody else does it first, please post. :slight_smile:

One more thing, the formula above is from the book “Vehicle Dynamics - Theory and Application” by Reza N. Jazar. It is great if you want more indepth knowledge of these things.

/Ricky

Thx for your information and advice. You have been more than helpfull :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: