Hello there! I’m facing a fatal crash in my project. I’m honestly unsure how to even find what exactly is causing the crash but I have a small lead and I’m running out of ideas on this one too.

## The Issue

As soon as I stop accelerating the car, and let it slow down, the engine crashes a few seconds in. This is the case most of the time. Other times, it crashes as soon as I press the accelerate button and some other times, nothing goes wrong at all and the game runs smoothly.

Since the engine is crashing consistently, I’m printing my debug logs to disk so that I can read them to figure out what’s happening. The logs below are basically of me slowing down after accelerating to a small speed.

Here are the logs:

```
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.52647 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.64322 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.46898 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.57007 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.39195 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.58551 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.41176 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.52304 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.35021 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.4494 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.27264 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.50871 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.33513 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.48712 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.31974 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.48793 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.30787 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.48582 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.2586 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.43383 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.2416 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.4092 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.19603 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.36167 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.17173 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.33401 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.1266 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.28914 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.0977 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.25927 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.05368 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.2164 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 19.02225 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.18483 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.98 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.14363 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.94737 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.11086 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.90699 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.07104 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.87387 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.03752 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.83508 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.99884 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.24256 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.23827 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.19269 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.23037 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.05155 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.4902 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.82081 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.114 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.10412 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.05892 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.11824 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.83801 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.02386 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 18.01054 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.97382 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.97036 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.9527 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.93493 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.9172 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.89951 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.88186 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.86425 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.84666 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.82911 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.81159 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.79408 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.77658 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.75911 || Current Gear = 1
[Current Drift Angle = 0
[|| Current RPM = 800 || Current Torque = 735 || Current Speed = 17.74163 || Current Gear = 1
[Current Drift Angle = NaN
[Drift torque added = 0
[Skipped updating the transform of this Rigidbody because its components are infinite. Could you have applied infinite forces, acceleration or set huge velocity?
[Skipped updating the transform of this Rigidbody because its components are infinite. Could you have applied infinite forces, acceleration or set huge velocity?
[Skipped updating the transform of this Rigidbody because its components are infinite. Could you have applied infinite forces, acceleration or set huge velocity?
[transform.position assign attempt for 'Follow VirtualCamera' is not valid. Input position is { NaN, NaN, NaN }.
[transform.position assign attempt for 'CinemachineBrain' is not valid. Input position is { NaN, NaN, NaN }.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[Invalid worldAABB. Object is too large or too far away from the origin.
[|| Current RPM = 800 || Current Torque = 1102.5 || Current Speed = NaN || Current Gear = 1
[Current Drift Angle = 90
[Drift torque added = 0
[transform.position assign attempt for 'J01_WFL' is not valid. Input position is { NaN, NaN, NaN }.
[transform.position assign attempt for 'J01_WFR' is not valid. Input position is { NaN, NaN, NaN }.
[transform.position assign attempt for 'J01_WBL' is not valid. Input position is { NaN, NaN, NaN }.
[transform.position assign attempt for 'J01_WBR' is not valid. Input position is { NaN, NaN, NaN }.
```

And here’s the code that the logs are printing:

```
float currentTorque = engineSO.GetCurrentTorque(currentRPM) * currentGear.gearRatio * driftMultiplier;
Debug.Log("|| Current RPM = " + currentRPM + " || Current Torque = " + currentTorque + " || Current Speed = " + speed + " || Current Gear = " + currentGear.gearID);
// calculate the angle between the direction of the car velocity and the direction in which the car is facing
float angle = (Mathf.Acos(Vector3.Dot(gameObject.transform.forward, GetCurrentVelocity().normalized))) * Mathf.Rad2Deg;
if (angle < 2 | speed < 4f | angle == float.NegativeInfinity | angle == float.PositiveInfinity)
{
angle = 0;
}
Debug.Log("Current Drift Angle = " + angle);
```

I can see that it talks about some infinite values but

### How do I find out what values exactly are going infinite and how do I avoid it?

Any help is truly appreciated