From 73301027358b870f77601583aec4edefd3bd6829 Mon Sep 17 00:00:00 2001 From: Titan Yuan Date: Mon, 16 Sep 2024 22:47:40 -0700 Subject: [PATCH] Fix lift-induced drag calculation --- Assets/Scripts/Missile.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Missile.cs b/Assets/Scripts/Missile.cs index b2e0c9f..f94a5ea 100644 --- a/Assets/Scripts/Missile.cs +++ b/Assets/Scripts/Missile.cs @@ -131,7 +131,8 @@ public class Missile : Agent { } private float CalculateLiftInducedDrag(Vector3 accelerationInput) { - float liftAcceleration = Vector3.Dot(accelerationInput, transform.forward); + float liftAcceleration = + (accelerationInput - Vector3.Dot(accelerationInput, transform.up) * transform.up).magnitude; float liftDragRatio = StaticConfig.liftDragConfig.liftDragRatio; return Mathf.Abs(liftAcceleration / liftDragRatio); }