Table of Contents

Class UniverseModel

Namespace
KSP.Sim.impl
Assembly
Assembly-CSharp.dll
public class UniverseModel : IUniverseModel, ISimulationModelMap, IFixedUpdate, IPriorityOverride, IUniverseTime
Inheritance
UniverseModel
Implements
Inherited Members
Extension Methods

Constructors

UniverseModel(double, InertialFrame, ILateUpdateDriver, MessageCenter)

public UniverseModel(double universalTime, InertialFrame inertialReferenceFrame, ILateUpdateDriver lateUpdateDriver, MessageCenter messageCenter)

Parameters

universalTime double
inertialReferenceFrame InertialFrame
lateUpdateDriver ILateUpdateDriver
messageCenter MessageCenter

Properties

CelestialBodiesCount

public int CelestialBodiesCount { get; }

Property Value

int

GalacticOrigin

public TransformModel GalacticOrigin { get; set; }

Property Value

TransformModel

HomeWorld

public CelestialBodyComponent HomeWorld { get; }

Property Value

CelestialBodyComponent

InverseRotAngle

public double InverseRotAngle { get; set; }

Property Value

double

IsSimObjectCountDirty

public bool IsSimObjectCountDirty { get; }

Property Value

bool

IsTimePaused

public bool IsTimePaused { get; }

Property Value

bool

ModelLookup

public ModelLookup ModelLookup { get; }

Property Value

ModelLookup

NumModels

public int NumModels { get; }

Property Value

int

Rotation

public QuaternionD Rotation { get; set; }

Property Value

QuaternionD

SimulationObjects

public IEnumerable<SimulationObjectModel> SimulationObjects { get; }

Property Value

IEnumerable<SimulationObjectModel>

Time

public SimUniverseTime Time { get; }

Property Value

SimUniverseTime

TimeScale

public float TimeScale { get; }

Property Value

float

UniverseTime

public double UniverseTime { get; }

Property Value

double

UniverseTimeDelta

public double UniverseTimeDelta { get; }

Property Value

double

ViewPrefabAssetKey

public string ViewPrefabAssetKey { get; }

Property Value

string

Zup

public CelestialFrame Zup { get; set; }

Property Value

CelestialFrame

inertialReferenceFrame

public InertialFrame inertialReferenceFrame { get; }

Property Value

InertialFrame

lateUpdateDriver

public ILateUpdateDriver lateUpdateDriver { get; }

Property Value

ILateUpdateDriver

Methods

AddCelestialBody(CelestialBodyComponent)

public bool AddCelestialBody(CelestialBodyComponent celestialBody)

Parameters

celestialBody CelestialBodyComponent

Returns

bool

AddColony(ColonyComponent)

public bool AddColony(ColonyComponent colony)

Parameters

colony ColonyComponent

Returns

bool

AddFlag(FlagComponent)

public bool AddFlag(FlagComponent flag)

Parameters

flag FlagComponent

Returns

bool

AddKerbal(KerbalComponent)

public bool AddKerbal(KerbalComponent kerbal)

Parameters

kerbal KerbalComponent

Returns

bool

AddPart(PartComponent)

public bool AddPart(PartComponent part)

Parameters

part PartComponent

Returns

bool

AddSimulationObject(SimulationObjectModel)

public bool AddSimulationObject(SimulationObjectModel model)

Parameters

model SimulationObjectModel

Returns

bool

AddVessel(VesselComponent)

public bool AddVessel(VesselComponent vessel)

Parameters

vessel VesselComponent

Returns

bool

AddWaypoint(WaypointComponent)

public bool AddWaypoint(WaypointComponent waypoint)

Parameters

waypoint WaypointComponent

Returns

bool

CheckDebrisBudget(VesselComponent)

public void CheckDebrisBudget(VesselComponent vessel)

Parameters

vessel VesselComponent

CheckModelGuidPrerequisuites(SimulationObjectModel, out string)

public bool CheckModelGuidPrerequisuites(SimulationObjectModel model, out string errorStringOut)

Parameters

model SimulationObjectModel
errorStringOut string

Returns

bool

DoesGlobalIdExist(IGGuid)

public bool DoesGlobalIdExist(IGGuid globalId)

Parameters

globalId IGGuid

Returns

bool

DoesGlobalNameKeyExist(string)

public bool DoesGlobalNameKeyExist(string globalNameKey)

Parameters

globalNameKey string

Returns

bool

DoesObjectIdExist(ulong)

public bool DoesObjectIdExist(ulong objectId)

Parameters

objectId ulong

Returns

bool

~UniverseModel()

protected ~UniverseModel()

FindCelestialBodyByName(string)

public CelestialBodyComponent FindCelestialBodyByName(string name)

Parameters

name string

Returns

CelestialBodyComponent

FindColonyComponent(IGGuid)

public ColonyComponent FindColonyComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

ColonyComponent

FindColonyComponent(byte, ushort)

public ColonyComponent FindColonyComponent(byte playerId, ushort objectId)

Parameters

playerId byte
objectId ushort

Returns

ColonyComponent

FindFlagComponent(IGGuid)

public FlagComponent FindFlagComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

FlagComponent

FindKerbalComponent(IGGuid)

public KerbalComponent FindKerbalComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

KerbalComponent

FindKerbalComponent(byte, ushort)

public KerbalComponent FindKerbalComponent(byte playerId, ushort objectId)

Parameters

playerId byte
objectId ushort

Returns

KerbalComponent

FindPartComponent(IGGuid)

public PartComponent FindPartComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

PartComponent

FindPartComponent(byte, ushort)

public PartComponent FindPartComponent(byte playerId, ushort objectId)

Parameters

playerId byte
objectId ushort

Returns

PartComponent

FindSimObject(IGGuid)

public SimulationObjectModel FindSimObject(IGGuid globalId)

Parameters

globalId IGGuid

Returns

SimulationObjectModel

FindSimObject(ulong)

public SimulationObjectModel FindSimObject(ulong objectId)

Parameters

objectId ulong

Returns

SimulationObjectModel

FindSimObjectByNameKey(string)

public SimulationObjectModel FindSimObjectByNameKey(string globalNameKey)

Parameters

globalNameKey string

Returns

SimulationObjectModel

FindSimObjectByString(string)

public SimulationObjectModel FindSimObjectByString(string globalId)

Parameters

globalId string

Returns

SimulationObjectModel

FindVesselComponent(IGGuid)

public VesselComponent FindVesselComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

VesselComponent

FindVesselComponent(byte, ushort)

public VesselComponent FindVesselComponent(byte playerId, ushort objectId)

Parameters

playerId byte
objectId ushort

Returns

VesselComponent

FindWaypointComponent(IGGuid)

public WaypointComponent FindWaypointComponent(IGGuid globalId)

Parameters

globalId IGGuid

Returns

WaypointComponent

FixedUpdateSimObjects()

public void FixedUpdateSimObjects()

GetAllCelestialBodies()

public List<CelestialBodyComponent> GetAllCelestialBodies()

Returns

List<CelestialBodyComponent>

GetAllColonies(byte)

public IEnumerable<ColonyComponent> GetAllColonies(byte playerId)

Parameters

playerId byte

Returns

IEnumerable<ColonyComponent>

GetAllColonies(byte, ref List<ColonyComponent>)

public void GetAllColonies(byte playerId, ref List<ColonyComponent> results)

Parameters

playerId byte
results List<ColonyComponent>

GetAllOwnedVessels(byte)

public IEnumerable<VesselComponent> GetAllOwnedVessels(byte playerId)

Parameters

playerId byte

Returns

IEnumerable<VesselComponent>

GetAllOwnedVessels(byte, ref List<VesselComponent>)

public void GetAllOwnedVessels(byte playerId, ref List<VesselComponent> results)

Parameters

playerId byte
results List<VesselComponent>

GetAllParts()

public IEnumerable<PartComponent> GetAllParts()

Returns

IEnumerable<PartComponent>

GetAllParts(byte)

public IEnumerable<PartComponent> GetAllParts(byte playerId)

Parameters

playerId byte

Returns

IEnumerable<PartComponent>

GetAllPartsInRange(Position, double, ref List<PartComponent>)

public int GetAllPartsInRange(Position position, double radius, ref List<PartComponent> results)

Parameters

position Position
radius double
results List<PartComponent>

Returns

int

GetAllSimObjects()

public IEnumerable<SimulationObjectModel> GetAllSimObjects()

Returns

IEnumerable<SimulationObjectModel>

GetAllSimObjectsForPlayerId(byte)

public IEnumerable<SimulationObjectModel> GetAllSimObjectsForPlayerId(byte playerId)

Parameters

playerId byte

Returns

IEnumerable<SimulationObjectModel>

GetAllVessels()

public List<VesselComponent> GetAllVessels()

Returns

List<VesselComponent>

GetAllVesselsInRange(Position, double)

public IEnumerable<VesselComponent> GetAllVesselsInRange(Position position, double radius)

Parameters

position Position
radius double

Returns

IEnumerable<VesselComponent>

GetAllVesselsInRange(Position, double, ref List<VesselComponent>, Func<Position, VesselComponent, bool>)

public int GetAllVesselsInRange(Position position, double radius, ref List<VesselComponent> results, Func<Position, VesselComponent, bool> funcFilter = null)

Parameters

position Position
radius double
results List<VesselComponent>
funcFilter Func<Position, VesselComponent, bool>

Returns

int

GetAllWaypoints()

public IEnumerable<WaypointComponent> GetAllWaypoints()

Returns

IEnumerable<WaypointComponent>

GetAltitudeAtPos(ICoordinateSystem, Vector3d)

public double GetAltitudeAtPos(ICoordinateSystem coordinateSystem, Vector3d position)

Parameters

coordinateSystem ICoordinateSystem
position Vector3d

Returns

double

GetAltitudeAtPos(ICoordinateSystem, Vector3d, CelestialBodyComponent)

public double GetAltitudeAtPos(ICoordinateSystem referenceFrame, Vector3d position, CelestialBodyComponent body)

Parameters

referenceFrame ICoordinateSystem
position Vector3d
body CelestialBodyComponent

Returns

double

GetAltitudeAtPos(Position)

public double GetAltitudeAtPos(Position position)

Parameters

position Position

Returns

double

GetAltitudeAtPos(Position, CelestialBodyComponent)

public double GetAltitudeAtPos(Position position, CelestialBodyComponent body)

Parameters

position Position
body CelestialBodyComponent

Returns

double

GetAtmDensity(double, double, CelestialBodyComponent)

public double GetAtmDensity(double pressure, double temperature, CelestialBodyComponent body)

Parameters

pressure double
temperature double
body CelestialBodyComponent

Returns

double

GetGeeForceAtPosition(ICoordinateSystem, Vector3d, CelestialBodyComponent)

public Vector GetGeeForceAtPosition(ICoordinateSystem coordinateSystem, Vector3d pos, CelestialBodyComponent mainBody)

Parameters

coordinateSystem ICoordinateSystem
pos Vector3d
mainBody CelestialBodyComponent

Returns

Vector

GetGeeForceAtPosition(Position, CelestialBodyComponent)

public Vector GetGeeForceAtPosition(Position pos, CelestialBodyComponent mainBody)

Parameters

pos Position
mainBody CelestialBodyComponent

Returns

Vector

GetMainBody(ICoordinateSystem, Vector3d)

public CelestialBodyComponent GetMainBody(ICoordinateSystem coordinateSystem, Vector3d refPos)

Parameters

coordinateSystem ICoordinateSystem
refPos Vector3d

Returns

CelestialBodyComponent

GetMainBody(Position)

public CelestialBodyComponent GetMainBody(Position position)

Parameters

position Position

Returns

CelestialBodyComponent

GetStar(ICoordinateSystem, Vector3d)

public CelestialBodyComponent GetStar(ICoordinateSystem coordinateSystem, Vector3d refPos)

Parameters

coordinateSystem ICoordinateSystem
refPos Vector3d

Returns

CelestialBodyComponent

GetStar(Position)

public CelestialBodyComponent GetStar(Position position)

Parameters

position Position

Returns

CelestialBodyComponent

GetStaticPressure(ICoordinateSystem, Vector3d)

public double GetStaticPressure(ICoordinateSystem coordinateSystem, Vector3d position)

Parameters

coordinateSystem ICoordinateSystem
position Vector3d

Returns

double

GetStaticPressure(ICoordinateSystem, Vector3d, CelestialBodyComponent)

public double GetStaticPressure(ICoordinateSystem coordinateSystem, Vector3d position, CelestialBodyComponent body)

Parameters

coordinateSystem ICoordinateSystem
position Vector3d
body CelestialBodyComponent

Returns

double

GetStaticPressure(Position)

public double GetStaticPressure(Position position)

Parameters

position Position

Returns

double

GetStaticPressure(Position, CelestialBodyComponent)

public double GetStaticPressure(Position position, CelestialBodyComponent body)

Parameters

position Position
body CelestialBodyComponent

Returns

double

GetStaticPressure(double, CelestialBodyComponent)

public double GetStaticPressure(double altitude, CelestialBodyComponent body)

Parameters

altitude double
body CelestialBodyComponent

Returns

double

GetUpAxis(Position)

public Vector GetUpAxis(Position position)

Parameters

position Position

Returns

Vector

GetUpAxis(CelestialBodyComponent, ICoordinateSystem, Vector3d)

public Vector GetUpAxis(CelestialBodyComponent body, ICoordinateSystem coordinateSystem, Vector3d position)

Parameters

body CelestialBodyComponent
coordinateSystem ICoordinateSystem
position Vector3d

Returns

Vector

GetUpAxis(CelestialBodyComponent, Position)

public Vector GetUpAxis(CelestialBodyComponent body, Position position)

Parameters

body CelestialBodyComponent
position Position

Returns

Vector

LateUpdateSimObjects()

public void LateUpdateSimObjects()

RemoveCelestialBody(CelestialBodyComponent)

public void RemoveCelestialBody(CelestialBodyComponent celestialBody)

Parameters

celestialBody CelestialBodyComponent

RemoveColony(ColonyComponent)

public void RemoveColony(ColonyComponent colony)

Parameters

colony ColonyComponent

RemoveFlag(FlagComponent)

public void RemoveFlag(FlagComponent flag)

Parameters

flag FlagComponent

RemoveKerbal(KerbalComponent)

public void RemoveKerbal(KerbalComponent kerbal)

Parameters

kerbal KerbalComponent

RemovePart(PartComponent)

public void RemovePart(PartComponent part)

Parameters

part PartComponent

RemoveSimulationObject(SimulationObjectModel)

public void RemoveSimulationObject(SimulationObjectModel model)

Parameters

model SimulationObjectModel

RemoveVessel(VesselComponent)

public void RemoveVessel(VesselComponent vessel)

Parameters

vessel VesselComponent

RemoveWaypoint(WaypointComponent)

public void RemoveWaypoint(WaypointComponent waypoint)

Parameters

waypoint WaypointComponent

Reset()

public void Reset()

SetTimePaused(bool)

public bool SetTimePaused(bool isPaused)

Parameters

isPaused bool

Returns

bool

SetTimeScale(float, bool)

public void SetTimeScale(float timeScale, bool scalePhysics = false)

Parameters

timeScale float
scalePhysics bool

SetUniverseTime(double, double)

public void SetUniverseTime(double ut, double deltaUT)

Parameters

ut double
deltaUT double

TryFindTransform(ITransformModel, string, out ITransformModel)

public bool TryFindTransform(ITransformModel root, string name, out ITransformModel result)

Parameters

root ITransformModel
name string
result ITransformModel

Returns

bool

TryFindTransform(string, out ITransformModel)

public bool TryFindTransform(string name, out ITransformModel result)

Parameters

name string
result ITransformModel

Returns

bool

UpdateSimObjects()

public void UpdateSimObjects()

ZupAtUT(double, CelestialBodyComponent, ref CelestialFrame)

public void ZupAtUT(double UT, CelestialBodyComponent body, ref CelestialFrame tempZup)

Parameters

UT double
body CelestialBodyComponent
tempZup CelestialFrame

Events

PausedChanged

public event Action<bool> PausedChanged

Event Type

Action<bool>

TimescaleChanged

public event Action<bool, TimeScaleValues> TimescaleChanged

Event Type

Action<bool, TimeScaleValues>

onCelestialBodyAdded

public event Action<CelestialBodyComponent> onCelestialBodyAdded

Event Type

Action<CelestialBodyComponent>

onCelestialBodyRemoved

public event Action<CelestialBodyComponent> onCelestialBodyRemoved

Event Type

Action<CelestialBodyComponent>

onPartAdded

public event Action<PartComponent> onPartAdded

Event Type

Action<PartComponent>

onPartRemoved

public event Action<PartComponent> onPartRemoved

Event Type

Action<PartComponent>

onSimulationObjectAdded

public event Action<SimulationObjectModel> onSimulationObjectAdded

Event Type

Action<SimulationObjectModel>

onSimulationObjectRemoved

public event Action<SimulationObjectModel> onSimulationObjectRemoved

Event Type

Action<SimulationObjectModel>

onVesselAdded

public event Action<VesselComponent> onVesselAdded

Event Type

Action<VesselComponent>

onVesselRemoved

public event Action<VesselComponent> onVesselRemoved

Event Type

Action<VesselComponent>