Fix compensating acceleration input for gravity
parent
23de73662c
commit
ead655695e
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue