The Re-Inventing the Wheel Thread

If you want to fix they normals you just have to use a two sided material.

If you want to fix the cars flying into the air or disapearing it’s a simple fix.
You have to change the following lines

FVector AntiRollForceF = FVector();
and
FVector AntiRollForceB = FVector();

to

FVector AntiRollForceF = FVector(0);
and
FVector AntiRollForceB = FVector(0);

The current code creates an uninitialized vector and appends to it. :wink:

Also line
float GripMultiplier = FMath::Max(TraceLength/SpringLengthArray[Index], MaxGrip);

Should be

float GripMultiplier = FMath::Min(TraceLength/SpringLengthArray[Index], MaxGrip);

Also the Long slip and slip thresholds are summed when they should be clipped as an ellipse
The code below would need the tire smoke fixed too, but if you change

TireForces *= GripMultiplier;
to



float ForwardComponent = FVector::DotProduct(TireForces.GetSafeNormal(),WheelForward) * LongSlipThreshold;
float RightComponent = FVector::DotProduct(TireForces.GetSafeNormal(), WheelRight) * SlipThreshold;
float MaxLength = FMath::Sqrt(ForwardComponent * ForwardComponent + RightComponent * RightComponent);
TireForces = TireForces.GetClampedToSize(0.0f, MaxLength);

TireForces *= GripMultiplier;

It should produce more accurate results.