Use defined gravity constant

more-targets
Titan Yuan 2024-09-12 20:02:41 -07:00
parent 4acc2fd32c
commit 10bdd5db16
3 changed files with 6 additions and 6 deletions

View File

@ -3,10 +3,10 @@ using System;
public static class Constants
{
// Constants (these should be defined with appropriate values)
private const double kAirDensity = 1.204; // Sea level air density in kg/m^3
private const double kAirDensityScaleHeight = 10.4; // Scale height in km
private const double kGravity = 9.80665; // Standard gravity in m/s^2
private const double kEarthMeanRadius = 6378137; // Earth's mean radius in meters
public const double kAirDensity = 1.204; // Sea level air density in kg/m^3
public const double kAirDensityScaleHeight = 10.4; // Scale height in km
public const double kGravity = 9.80665; // Standard gravity in m/s^2
public const double kEarthMeanRadius = 6378137; // Earth's mean radius in meters
public static double CalculateAirDensityAtAltitude(double altitude)
{

View File

@ -4,7 +4,7 @@ using UnityEngine;
public class Micromissile : Missile
{
[SerializeField] private float _navigationGain = 5f; // Typically 3-5
[SerializeField] private float _navigationGain = 3f; // Typically 3-5
private Vector3 _previousLOS;
private Vector3 _accelerationCommand;

View File

@ -112,7 +112,7 @@ public class Missile : Agent
protected float CalculateMaxAcceleration()
{
float maxReferenceAcceleration = StaticConfig.accelerationConfig.maxReferenceAcceleration * Physics.gravity.magnitude;
float maxReferenceAcceleration = (float)(StaticConfig.accelerationConfig.maxReferenceAcceleration * Constants.kGravity);
float referenceSpeed = StaticConfig.accelerationConfig.referenceSpeed;
return Mathf.Pow(GetComponent<Rigidbody>().velocity.magnitude / referenceSpeed, 2) * maxReferenceAcceleration;
}