Fix compensating acceleration input for gravity

more-targets
Titan Yuan 2024-09-12 22:38:44 -07:00
parent 23de73662c
commit ead655695e
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class Hydra70 : Missile
{ {
Vector3 accelerationInput = Vector3.zero; Vector3 accelerationInput = Vector3.zero;
// Calculate and set the total acceleration // Calculate and set the total acceleration
Vector3 acceleration = CalculateAcceleration(accelerationInput, compensateForGravity: true); Vector3 acceleration = CalculateAcceleration(accelerationInput);
GetComponent<Rigidbody>().AddForce(acceleration, ForceMode.Acceleration); GetComponent<Rigidbody>().AddForce(acceleration, ForceMode.Acceleration);
_acceleration = acceleration; _acceleration = acceleration;
} }

View File

@ -59,7 +59,7 @@ public class Missile : Agent
} }
protected Vector3 CalculateAcceleration(Vector3 accelerationInput, bool compensateForGravity = true) protected Vector3 CalculateAcceleration(Vector3 accelerationInput, bool compensateForGravity = false)
{ {
Vector3 gravity = Physics.gravity; Vector3 gravity = Physics.gravity;
if (compensateForGravity) if (compensateForGravity)