NaN Wrote:Cool. I'll have a look.
After endless tries i succeded in obtaining a somewhat working clutch.
This is the im using:
Code:
public float GetDragImpulse(float engine_speed, float drive_speed, float engineInertia, float drivetrainInertia, float ratio, float engineTorquedt){
float drivetrainInertiaR=drivetrainInertia/ratio;
impulseLimit=clutch_position*torqueCapacity*Time.deltaTime;
float lambda=(engineInertia*drivetrainInertiaR*(drive_speed - engine_speed) - drivetrainInertiaR*engineTorquedt)/(engineInertia + drivetrainInertiaR);
lambda = Mathf.Clamp(lambda, -impulseLimit, impulseLimit);
return lambda;
}
engineTorquedt = engineTorque*Time.deltaTime;
drivetrainInertia=1;
engineInertia=0.5f;
drivetrainInertia is summed to each wheel inertia (1.8f).
This works with 50Hz and 1 single iteration.
Im still experiencing that infamous clutch lag, so I had to use a patch in order to decrease ratio value in drivetrainInertia/ratio by a value inverse proportional to the same ratio.
Let me know what you think.