mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Refactor some CR physics stuff
This commit is contained in:
parent
2760bfd625
commit
f24ace0721
@ -1,11 +1,11 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using NewHorizons.External.Configs;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Components.Orbital;
|
||||
|
||||
namespace NewHorizons.Builder.General
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using NewHorizons.Builder.Orbital;
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using OWML.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -83,9 +83,9 @@ namespace NewHorizons.Builder.General
|
||||
var primaryGV = primary.GetGravityVolume();
|
||||
var secondaryGV = secondary.GetGravityVolume();
|
||||
|
||||
if (primaryGV.GetFalloffType() != secondaryGV.GetFalloffType())
|
||||
if (primaryGV._falloffType != secondaryGV._falloffType)
|
||||
{
|
||||
Logger.LogError($"Binaries must have the same gravity falloff! {primaryGV.GetFalloffType()} != {secondaryGV.GetFalloffType()}");
|
||||
Logger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Common;
|
||||
using OWML.Utils;
|
||||
@ -15,6 +14,7 @@ using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using NewHorizons.External.Configs;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Components.Orbital;
|
||||
|
||||
namespace NewHorizons.Builder.General
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace NewHorizons.Builder.General
|
||||
if (config.Orbit.PrimaryBody != null && parent == HeavenlyBody.None)
|
||||
Logger.LogWarning($"Could not find [{config.Orbit.PrimaryBody}] parent of [{config.Name}]");
|
||||
|
||||
var orbit = OrbitalHelper.KeplerCoordinatesFromOrbitModule(config.Orbit);
|
||||
var orbit = config.Orbit.GetKeplerCoords();
|
||||
|
||||
var hb = GetBody(config.Name);
|
||||
if (hb == null) hb = AddHeavenlyBody(config.Name, config.FocalPoint != null);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.External;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@ -6,10 +6,11 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using System.Reflection;
|
||||
using NewHorizons.Utility;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using NewHorizons.Utility.CommonResources;
|
||||
|
||||
namespace NewHorizons.Builder.Orbital
|
||||
{
|
||||
@ -43,7 +44,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
var gv = primaryBody.GetGravityVolume();
|
||||
if(gv != null)
|
||||
{
|
||||
var velocity = OrbitalHelper.GetCartesian(new OrbitalHelper.Gravity(primaryBody.GetGravityVolume()), orbit).Item2;
|
||||
var velocity = CommonResourcesUtilities.GetCartesian(gv, orbit).Item2;
|
||||
|
||||
// For some stupid reason the InitialMotion awake method transforms the perfectly fine direction vector you give it so we preemptively do the inverse so it all cancels out
|
||||
initialMotion._initLinearDirection = body.transform.InverseTransformDirection(velocity.normalized);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using OWML.Utils;
|
||||
using UnityEngine;
|
||||
using NewHorizons.External.Configs;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Components.Orbital;
|
||||
|
||||
namespace NewHorizons.Builder.Orbital
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using NewHorizons.Builder.Orbital;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.CommonResources;
|
||||
using PacificEngine.OW_CommonResources.Game.Resource;
|
||||
using PacificEngine.OW_CommonResources.Game.State;
|
||||
using System;
|
||||
@ -26,7 +26,7 @@ namespace NewHorizons.Builder.Updater
|
||||
{
|
||||
var original = mapping[heavenlyBody];
|
||||
|
||||
var coords = OrbitalHelper.KeplerCoordinatesFromOrbitModule(body.Config.Orbit);
|
||||
var coords = body.Config.Orbit.GetKeplerCoords();
|
||||
|
||||
var parent = original.state.parent;
|
||||
if (body.Config.Orbit.PrimaryBody != null)
|
||||
|
||||
@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.OrbitalPhysics
|
||||
namespace NewHorizons.Components.Orbital
|
||||
{
|
||||
public class BinaryFocalPoint : MonoBehaviour
|
||||
{
|
||||
53
NewHorizons/Components/Orbital/ParameterizedAstroObject.cs
Normal file
53
NewHorizons/Components/Orbital/ParameterizedAstroObject.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using NewHorizons.External;
|
||||
using NewHorizons.Utility.CommonResources;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.Components.Orbital
|
||||
{
|
||||
public class ParameterizedAstroObject : AstroObject, IKeplerCoordinates
|
||||
{
|
||||
public float Inclination { get; set; }
|
||||
public int SemiMajorAxis { get; set; }
|
||||
public float LongitudeOfAscendingNode { get; set; }
|
||||
public float Eccentricity { get; set; }
|
||||
public float ArgumentOfPeriapsis { get; set; }
|
||||
public float TrueAnomaly { get; set; }
|
||||
|
||||
public void SetKeplerCoordinatesFromOrbitModule(OrbitModule orbit)
|
||||
{
|
||||
var keplerCoordinates = KeplerCoordinates.fromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
||||
Inclination = keplerCoordinates.inclinationAngle;
|
||||
SemiMajorAxis = (int)keplerCoordinates.semiMajorRadius;
|
||||
LongitudeOfAscendingNode = keplerCoordinates.ascendingAngle;
|
||||
Eccentricity = keplerCoordinates.eccentricity;
|
||||
ArgumentOfPeriapsis = keplerCoordinates.periapseAngle;
|
||||
TrueAnomaly = keplerCoordinates.trueAnomaly;
|
||||
}
|
||||
|
||||
public void SetKeplerCoordinatesFromTrueAnomaly(float ecc, float a, float i, float p, float l, float trueAnomaly)
|
||||
{
|
||||
var keplerCoordinates = KeplerCoordinates.fromTrueAnomaly(ecc, a, i, p, l, trueAnomaly);
|
||||
Inclination = keplerCoordinates.inclinationAngle;
|
||||
SemiMajorAxis = (int)keplerCoordinates.semiMajorRadius;
|
||||
LongitudeOfAscendingNode = keplerCoordinates.ascendingAngle;
|
||||
Eccentricity = keplerCoordinates.eccentricity;
|
||||
ArgumentOfPeriapsis = keplerCoordinates.periapseAngle;
|
||||
TrueAnomaly = keplerCoordinates.trueAnomaly;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ParameterizedAstroObject: Eccentricity {Eccentricity}, SemiMajorAxis {SemiMajorAxis}, Inclination {Inclination}, ArgumentOfPeriapsis {ArgumentOfPeriapsis}, LongitudeOfAscendingNode {LongitudeOfAscendingNode}, TrueAnomaly {TrueAnomaly}";
|
||||
}
|
||||
|
||||
public KeplerCoordinates GetKeplerCoords()
|
||||
{
|
||||
return KeplerCoordinates.fromTrueAnomaly(Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.OrbitalPhysics
|
||||
namespace NewHorizons.Components.Orbital
|
||||
{
|
||||
public class TrackingOrbitLine : OrbitLine
|
||||
{
|
||||
9
NewHorizons/External/OrbitModule.cs
vendored
9
NewHorizons/External/OrbitModule.cs
vendored
@ -1,4 +1,6 @@
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.CommonResources;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -7,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.External
|
||||
{
|
||||
public class OrbitModule : Module
|
||||
public class OrbitModule : Module, IKeplerCoordinates
|
||||
{
|
||||
public int SemiMajorAxis { get; set; }
|
||||
public float Inclination { get; set; }
|
||||
@ -24,5 +26,10 @@ namespace NewHorizons.External
|
||||
public bool IsStatic { get; set; }
|
||||
public MColor Tint { get; set; }
|
||||
public bool TrackingOrbitLine { get; set; } = false;
|
||||
|
||||
public KeplerCoordinates GetKeplerCoords()
|
||||
{
|
||||
return KeplerCoordinates.fromTrueAnomaly(Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ using NewHorizons.External;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.External.VariableSize;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using NewHorizons.Utility;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OWML.Common;
|
||||
@ -26,6 +25,8 @@ using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.Builder.Atmosphere;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using NewHorizons.Utility.CommonResources;
|
||||
|
||||
namespace NewHorizons
|
||||
{
|
||||
@ -770,7 +771,7 @@ namespace NewHorizons
|
||||
private void UpdatePosition(GameObject go, NewHorizonsBody body, AstroObject primaryBody)
|
||||
{
|
||||
go.transform.parent = Locator.GetRootTransform();
|
||||
go.transform.position = OrbitalHelper.GetCartesian(new OrbitalHelper.Gravity(1, 100), body.Config.Orbit).Item1 + (primaryBody == null ? Vector3.zero : primaryBody.transform.position);
|
||||
go.transform.position = CommonResourcesUtilities.GetPosition(body.Config.Orbit) + (primaryBody == null ? Vector3.zero : primaryBody.transform.position);
|
||||
|
||||
if (go.transform.position.magnitude > FurthestOrbit)
|
||||
{
|
||||
|
||||
@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using NewHorizons.Utility;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.External;
|
||||
using CRGravity = PacificEngine.OW_CommonResources.Geometry.Orbits.Gravity;
|
||||
using KeplerCoordinates = PacificEngine.OW_CommonResources.Geometry.Orbits.KeplerCoordinates;
|
||||
|
||||
/*
|
||||
* Wrapper class for OW_CommonResources.Geometry.Orbits functions
|
||||
*/
|
||||
namespace NewHorizons.OrbitalPhysics
|
||||
{
|
||||
public static class OrbitalHelper
|
||||
{
|
||||
public enum FalloffType
|
||||
{
|
||||
inverseSquared,
|
||||
linear,
|
||||
none
|
||||
}
|
||||
|
||||
public static Tuple<Vector3, Vector3> GetCartesian(Gravity gravity, OrbitModule orbit)
|
||||
{
|
||||
if (orbit.SemiMajorAxis == 0)
|
||||
{
|
||||
return Tuple.Create(Vector3.zero, Vector3.zero);
|
||||
}
|
||||
|
||||
var crGravity = new CRGravity(GravityVolume.GRAVITATIONAL_CONSTANT, gravity.Exponent, gravity.Mass);
|
||||
var kepler = KeplerCoordinates.fromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
||||
var cartesian = PacificEngine.OW_CommonResources.Geometry.Orbits.OrbitHelper.toCartesian(crGravity, 0f, kepler);
|
||||
|
||||
if (cartesian == null)
|
||||
{
|
||||
cartesian = Tuple.Create(Vector3.zero, Vector3.zero);
|
||||
}
|
||||
|
||||
return cartesian;
|
||||
}
|
||||
|
||||
public static Tuple<Vector3, Vector3> GetCartesian(Gravity gravity, ParameterizedAstroObject ao)
|
||||
{
|
||||
if (ao.SemiMajorAxis == 0)
|
||||
{
|
||||
return Tuple.Create(Vector3.zero, Vector3.zero);
|
||||
}
|
||||
|
||||
var crGravity = new CRGravity(GravityVolume.GRAVITATIONAL_CONSTANT, gravity.Exponent, gravity.Mass);
|
||||
var kepler = KeplerCoordinates.fromTrueAnomaly(ao.Eccentricity, ao.SemiMajorAxis, ao.Inclination, ao.ArgumentOfPeriapsis, ao.LongitudeOfAscendingNode, ao.TrueAnomaly);
|
||||
var cartesian = PacificEngine.OW_CommonResources.Geometry.Orbits.OrbitHelper.toCartesian(crGravity, 0f, kepler);
|
||||
|
||||
if (cartesian == null)
|
||||
{
|
||||
cartesian = Tuple.Create(Vector3.zero, Vector3.zero);
|
||||
}
|
||||
|
||||
return cartesian;
|
||||
}
|
||||
|
||||
public static KeplerCoordinates KeplerCoordinatesFromOrbitModule(OrbitModule orbit)
|
||||
{
|
||||
return KeplerCoordinates.fromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
||||
}
|
||||
|
||||
public class Gravity
|
||||
{
|
||||
public float Exponent { get; }
|
||||
public float Mass { get; }
|
||||
|
||||
public Gravity(float exponent, float mass)
|
||||
{
|
||||
Exponent = exponent;
|
||||
Mass = mass;
|
||||
}
|
||||
|
||||
public Gravity(GravityVolume gv)
|
||||
{
|
||||
Exponent = gv.GetFalloffExponent();
|
||||
Mass = gv.GetStandardGravitationalParameter() / GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,60 +0,0 @@
|
||||
using NewHorizons.External;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.OrbitalPhysics
|
||||
{
|
||||
public class ParameterizedAstroObject : AstroObject
|
||||
{
|
||||
private KeplerCoordinates _keplerCoordinates;
|
||||
|
||||
public float Eccentricity
|
||||
{
|
||||
get { return _keplerCoordinates.eccentricity; }
|
||||
}
|
||||
|
||||
public float SemiMajorAxis
|
||||
{
|
||||
get { return _keplerCoordinates.semiMajorRadius; }
|
||||
}
|
||||
|
||||
public float Inclination
|
||||
{
|
||||
get { return _keplerCoordinates.inclinationAngle; }
|
||||
}
|
||||
|
||||
public float ArgumentOfPeriapsis
|
||||
{
|
||||
get { return _keplerCoordinates.periapseAngle; }
|
||||
}
|
||||
|
||||
public float LongitudeOfAscendingNode
|
||||
{
|
||||
get { return _keplerCoordinates.ascendingAngle; }
|
||||
}
|
||||
|
||||
public float TrueAnomaly
|
||||
{
|
||||
get { return _keplerCoordinates.trueAnomaly; }
|
||||
}
|
||||
|
||||
public void SetKeplerCoordinatesFromOrbitModule(OrbitModule orbit)
|
||||
{
|
||||
_keplerCoordinates = KeplerCoordinates.fromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
||||
}
|
||||
|
||||
public void SetKeplerCoordinatesFromTrueAnomaly(float ecc, float a, float i, float p, float l, float trueAnomaly)
|
||||
{
|
||||
_keplerCoordinates = KeplerCoordinates.fromTrueAnomaly(ecc, a, i, p, l, trueAnomaly);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ParameterizedAstroObject: Eccentricity {Eccentricity}, SemiMajorAxis {SemiMajorAxis}, Inclination {Inclination}, ArgumentOfPeriapsis {ArgumentOfPeriapsis}, LongitudeOfAscendingNode {LongitudeOfAscendingNode}, TrueAnomaly {TrueAnomaly}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,13 @@
|
||||
using PacificEngine.OW_CommonResources.Game.Resource;
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Utility
|
||||
namespace NewHorizons.Utility.CommonResources
|
||||
{
|
||||
public static class CommonResourcesUtilities
|
||||
{
|
||||
@ -57,5 +59,39 @@ namespace NewHorizons.Utility
|
||||
return HeavenlyBodies.None;
|
||||
}
|
||||
}
|
||||
|
||||
public static Gravity GravityFromVolume(GravityVolume gv)
|
||||
{
|
||||
if (gv == null) return null;
|
||||
|
||||
var constant = GravityVolume.GRAVITATIONAL_CONSTANT;
|
||||
var falloff = gv._falloffExponent;
|
||||
var mass = gv._gravitationalMass / constant;
|
||||
return new Gravity(constant, falloff, mass);
|
||||
}
|
||||
|
||||
public static Tuple<Vector3, Vector3> GetCartesian(Gravity gravity, IKeplerCoordinates keplerCoords)
|
||||
{
|
||||
var cartesian = OrbitHelper.toCartesian(gravity, 0f, keplerCoords.GetKeplerCoords());
|
||||
|
||||
// CR breaks when a = 0
|
||||
if(keplerCoords.SemiMajorAxis == 0)
|
||||
{
|
||||
cartesian = Tuple.Create(Vector3.zero, cartesian.Item2);
|
||||
}
|
||||
|
||||
return cartesian;
|
||||
}
|
||||
|
||||
public static Tuple<Vector3, Vector3> GetCartesian(GravityVolume gv, IKeplerCoordinates keplerCoords)
|
||||
{
|
||||
return GetCartesian(GravityFromVolume(gv), keplerCoords);
|
||||
}
|
||||
|
||||
public static Vector3 GetPosition(IKeplerCoordinates keplerCoords)
|
||||
{
|
||||
if (keplerCoords.SemiMajorAxis == 0) return Vector3.zero;
|
||||
return OrbitHelper.toCartesian(new Gravity(1, 1, 1), 0f, keplerCoords.GetKeplerCoords()).Item1;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
NewHorizons/Utility/CommonResources/IKeplerCoordinates.cs
Normal file
21
NewHorizons/Utility/CommonResources/IKeplerCoordinates.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using PacificEngine.OW_CommonResources.Geometry.Orbits;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NewHorizons.Utility.CommonResources
|
||||
{
|
||||
public interface IKeplerCoordinates
|
||||
{
|
||||
float Inclination { get; set; }
|
||||
int SemiMajorAxis { get; set; }
|
||||
float LongitudeOfAscendingNode { get; set; }
|
||||
float Eccentricity { get; set; }
|
||||
float ArgumentOfPeriapsis { get; set; }
|
||||
float TrueAnomaly { get; set; }
|
||||
|
||||
KeplerCoordinates GetKeplerCoords();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using NewHorizons.OrbitalPhysics;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
@ -20,14 +19,6 @@ namespace NewHorizons.Utility
|
||||
return (T)dict[settingName];
|
||||
}
|
||||
|
||||
public static OrbitalHelper.FalloffType GetFalloffType(this GravityVolume gv)
|
||||
{
|
||||
if (gv == null) return OrbitalHelper.FalloffType.none;
|
||||
var falloffTypeString = typeof(GravityVolume).GetField("_falloffType", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(gv).ToString();
|
||||
var falloffType = falloffTypeString.Equals("linear") ? OrbitalHelper.FalloffType.linear : OrbitalHelper.FalloffType.inverseSquared;
|
||||
return falloffType;
|
||||
}
|
||||
|
||||
public static float GetFalloffExponent(this GravityVolume gv)
|
||||
{
|
||||
if (gv == null) return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user