major rework

This commit is contained in:
max
2026-02-16 18:32:48 +01:00
parent bbd82da07e
commit 932734e5b4
24 changed files with 1706 additions and 893 deletions

View File

@@ -0,0 +1,30 @@
namespace Car_simulation.Core.Physics
{
public static class PhysicsUtil
{
public const float G = 9.81f;
public const float AirDensity = 1.225f;
public const float RAD_PER_SEC_TO_RPM = 60f / (2f * MathF.PI);
public const float RPM_TO_RAD_PER_SEC = (2f * MathF.PI) / 60f;
public static float Lerp(float a, float b, float t)
{
t = Math.Clamp(t, 0f, 1f);
return a + (b - a) * t;
}
public static float RPMToOmega(float rpm) => rpm * MathF.PI * 2f / 60f;
public static float OmegaToRPM(float omega) => omega * 60f / (2f * MathF.PI);
public static float CalculateRotationalEnergy(float inertia, float omega)
{
return 0.5f * inertia * omega * omega;
}
public static float CalculateOmegaFromEnergy(float energy, float inertia)
{
if (energy <= 0) return 0;
return MathF.Sqrt(2f * energy / inertia);
}
}
}