Hey all,
Im currently working on a car physics simulation and I am implementing the torque curve (in Nm)/RPM of an MX5. So I created an Array with a step for every 1000RPM so from : 0 RPM to 7000 RPM :
public int[] maxMotorTorqueAtRPM = new int[8] { 0, 80, 169, 196, 210, 215, 195, 0 };
// arrayposition * 1000 = RPM > maxMotorTorqueAtRPM
So lets say RPM = 2000, then torque is 169nm
But because the array is in steps of 1000RPM, i would need to use some interpolation to read the
ex. : torque value for 3421 RPM.
So I make a method :
public float CheckInterpolatedMaxMotorTorqueAtRPM (int []maxMotorTorqueAtRPM, int currentMotorRPM)
{
int interpolatedMaxMotorTorqueAtRPM = Mathf.Lerp (I dont know what to here)
}
I’ve looked all over the web but I cant seem to find the proper syntax to do this
Image for clarification :
The green dots are the points in the Array, and the purple line is what i want to interpolate.
Thanks,
Olivier Wierda