Gravity Engine 12.0
Unity Asset for Gravity
|
A generic double precision orbit class. Can be used in place of OrbitEllipse and OrbitHyper. More...
Public Types | |
enum | EvolveMode { GRAVITY_ENGINE , KEPLERS_EQN , SGP4_PROPAGATOR , PKEPLER_J2 } |
Mode for evolution; NBody simulation in GE or "on-rails" using Kepler equation. | |
enum | InputMode { DOUBLE , DOUBLE_ELLIPSE , ELLIPSE_MAJOR_AXIS_A , ELLIPSE_APOGEE_PERIGEE , ECC_PERIGEE , TWO_LINE_ELEMENT_SET } |
Public Member Functions | |
virtual void | InitNBody (float physicalScale, float massScale) |
Inits the N body. Called prior to evolution starting. Allows NBody object to adjust its position and velocity prior to evolution beginning. | |
void | InitFromActiveNBody (NBody activeNbody, NBody center, EvolveMode mode) |
Use an active NBody that is live in GE to initialize an orbit. | |
void | InitFromJplEphemeris (string data) |
void | InitCOEFromTLEData () |
Init the classical orbital element (COE) from Celestrak two-line element (TLE) information. | |
string | TLEStartEpoch () |
void | Init () |
void | Reset () |
Reset the OrbitPredictor init mode. | |
void | SetMajorAxisInspector (double a) |
For ellipses can specify size using major-axis. Typically used by editor script, but may have other uses. | |
double | GetMajorAxisInspector () |
Get the major axis for the orbit using the inspector value (world units). | |
double | GetMajorAxis () |
Get the Major Axis is internal physical units. If the orbit is an ellipse the major axis is valid. If the orbit is a hyperbola, then the value of p will be negative and there is no major axis value. | |
double | GetApogeeInspector () |
Get the apogee (point of greatest distance from focus) for the orbit in Scaled units (e.g. ORBITAL). This is typically used in the inspector prior to the game starting. | |
double | GetApogee () |
Determine the orbit apogee (apoapsis) is internal physics units. | |
double | GetSemiParam () |
SGP4toGE | GetSGP4ToGE () |
double | GetEnergy () |
Compute a real-time value for the orbital energy based on (r,v) | |
double | GetPerigeeInspector () |
Get the perigee (point of closest approach to the focus) for the orbit in Scaled units (e.g. ORBITAL). This is typically used in the inspector prior to the game starting. | |
double | GetPerigee () |
Determine the orbit preigee (periapsis) is internal physics units. | |
void | SetSizeWithApogeePerigee (double apogee, double perigee) |
Set the size and eccentricity of the ellipse by using values for apogee and perigee. (To be precise really should call them apoapsis and periapsis, but more people will know apogee/perigee). | |
void | SetSizeWithEccPerigee (double ecc, double perigee) |
void | SetOrbitPredictor (bool flag) |
delegate void | SGP4ErrorCallback (OrbitUniversal ou, int error) |
In SGP4 propagation the satellite can decay to the point where it should not be propagated. Users may wish to trigger a callback on this event. This allows for a callback to be registered. | |
void | AddSGP4ErrorCallback (SGP4ErrorCallback errorCallback) |
Callback for when an SGP4 satellite decays. | |
double | GetMu () |
void | SetMu (double mu) |
Set the mass of the orbit system. This is intended for use when OrbitU is not attached to an NBody e.g. in the case of a DustOrbit. | |
void | InitMu () |
Init the value of mu from the nbody elements. Typically used by OrbitPredictor. | |
NBody | GetNBody () |
Vector3d | GetAxis () |
Get the normal vector to the orbital plane (normalized). | |
void | InitFromOrbitData (OrbitData od, double time) |
Initialize the Orbit from orbital elements contained in an OrbitData object. | |
void | CopyFromOrbitUniversal (OrbitUniversal fromOrbit) |
Init from another OrbitUniversal. | |
void | InitFromRVT (Vector3d r, Vector3d v, double time, NBody center, bool relativePos, bool updateState=false) |
Initialize the orbit using position, velocity and time. | |
void | SetDejitterCOE (bool value) |
void | ReInitForOrbitPredictor (Vector3d r, Vector3d v, double time) |
OrbitPredictor does not need to do a full re-init, just use RV to set new COE. | |
OrbitUtils.OrbitElements.TypeOrbit | PredictedOrbitType () |
When this OrbitU is being used as an orbit predictor report the last type that was determined by the RVtoCOE. | |
void | InitFromSolarBody (SolarBody sbody) |
Inits from solar body. This will always be an ellipse. | |
OrbitUtils.OrbitElements | GetPKeplerCOE () |
virtual void | ApplyScale (float scale) |
Interface to apply the scale to the distance parameter of an orbit. | |
virtual void | ApplyXZChange () |
virtual bool | IsOnRails () |
Check if body is configured at scene start to be fixed. (Allows objects to be optionally configured as not fixed, to allow e.g. Kepler eqn vs initial velocity in OrbitEllipse) | |
virtual void | PreEvolve (float physicalScale, float massScale) |
Called for each NBody object prior to evolution beginning. Allows a chance to setup internal state. | |
virtual void | Evolve (double physicsTime, GravityState gravityState, ref double[] r_new, ref double[] v_new, bool isQuery=false) |
Evolve the NBody. Implementating method uses physics time and scale to compute the new position, placing it in r. Velocity is also updated so that GetVelocity() can request it if it is of interest. | |
virtual void | EvolveSGP4 (double physicsTime, GravityState gravityState, double[] r_new, double[] v_new, bool isQuery=false) |
Evolve using the Simplified General Pertubation propagator model V4. | |
void | SetSGP4BlendTime (double time) |
void | LockAtTime (double lockTime) |
Use in On-Rails mode to lock an object at a specific time. Any evolve calls will not re-compute the position/velocity but instead leave them unchanged. | |
void | UnlockTime () |
Vector3d | GetLockedPosVel () |
double | GetPeriod () |
double | GetAngularVelocity () |
double | GetStartTime () |
void | GetRVT (ref Vector3d r0, ref Vector3d v0, ref double time0) |
Get the intial conditions for the orbit. R0 and V0 are always relative to the center body. If the center is not at (0,0,0) and/or moving, need to adjust values outside. | |
bool | RVT_Equal (ref Vector3d r0, ref Vector3d v0, ref double time0, double tol) |
Utility function (used by e.g. OrbitPredictor) to see if the orbit initial conditions have changed. Used to determine when an OP needs to recompute the orbit in KEPLER mode. | |
void | GetRVTAbsolute (ref Vector3d r0, ref Vector3d v0, ref double time0) |
void | GEUpdate (GravityEngine ge) |
Perform and update of the world game object position and velocity based on the internal state. | |
void | Move (Vector3 position) |
Move in response to a GE.MoveAll() call. (Not called from outside GE). | |
void | SetNBody (NBody nbody) |
Set the NBody that the orbit element will evolve. This is not commonly used, since the NBody is typically attached to the same game object as the FixedOrbit. The exception is when fixed orbit segments are part of a KeplerSequence (patched-conic evolution). | |
Vector3[] | OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping) |
Vector3[] | OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping, float hyperRadius) |
Vector3 | PositionForPhase (float phaseDeg) |
Get the position for the specified phase in physics co-ordinates. | |
Vector3 | VelocityForPhaseRelative (float phaseDeg) |
Vector3 | VelocityForPosition (Vector3 position) |
Given a position on the orbit (or a position that is used to establish a phase wrt the center) determine the velocity vector at that point on the orbit. | |
bool | CanApplyImpulse () |
NBody | GetCenterNBody () |
Return the center NBody for the fixed orbit. | |
void | UpdatePositionAndVelocity (Vector3 pos, Vector3 vel) |
Set a new start position for orbit evolution with respect to the current center object. | |
void | SetNewCenter (NBody newCenter) |
Set a new center object. Used when doing Kepler ("on-rails") evolution and the object enters the sphere of influence of a new body. The inital conditions (r0,v0, t0) are updated to be with respect to the new center object allowing Kepler evolution wrt the new center. | |
void | ChangeEvolveMode (EvolveMode newMode) |
Change the evolve mode between KEPLER and GRAVITY_ENGINE. i.e. go from off-rails to on-rails. | |
Vector3 | ApplyImpulse (Vector3 impulse) |
Apply an impulse to change the on-rails evolution (Kepler or SGP4). OrbitUniversal supports seamless changes from ellipse to parabola to hyperbola. This updates the initial conditions and start time (r0, v0, time0) | |
double | TimeOfFlight (Vector3d r0, Vector3d r1) |
Determine the time of flight in physics time units (GE internal time) that it takes for the body in orbit to go from relative position r0 to position r1. | |
double | TimeOfFlightEllipse (Vector3d r0, Vector3d r1) |
Find the time of flight from position r0 to r1 when the orbit is elliptical. | |
bool | IsCircular () |
Quaternion | GetConicOrientation () |
Vector3[] | HyperSegmentSymmetric (int numPoints, Vector3 centerPos, float radiusOrZero, bool doSceneMapping) |
Calculate points suitable for a line renderer that show a segment of the hyperbola for a specified radius with respect to the center. | |
Vector3[] | EllipseSegment (int numPoints, Vector3 centerPos, Vector3 pos, Vector3 destPoint, bool shortPath) |
Generate the points for an ellipse segment given the start and end positions. If shortPath then the short path between the points will be shown, otherwise the long way around. | |
Vector3[] | EllipseSegmentProRetro (int numPoints, Vector3 centerPos, Vector3 pos, Vector3 destPoint, bool retrograde) |
Generate the points for an ellipse segment given the start and end positions. | |
virtual string | DumpInfo () |
Create a string with info for display in GEConsole. | |
Vector3 | GetPositionForThetaRadians (float thetaRadians, Vector3 centerPos) |
Determine orbit position in physics space (with rotation and center offset) for the specified angle in the orbit (in radians) | |
Vector3d | GetPositionDForThetaRadians (double thetaRadians, bool relative) |
Determine orbit position in physics space (with rotation and center offset) for the specified angle in the orbit (in radians) | |
Vector3d | GetVelocityDForThetaRadians (double theta, bool relative) |
Vector3[] | GetPositionsForRadius (double radius, Vector3 centerPos) |
Get the positions where the orbit is at a specified radius. In general there are two. The result is positions in world space. These can then be used in e.g. TimeOfFlight. | |
float | GetPhaseDegForRadius (double radius) |
Get the phase for the specified radius/altitude. | |
OrbitUtils.OrbitElements | GetCurrentOrbitalElements () |
Get the current orbital elements using the live position and velocity from GE. | |
double | GetCurrentPhase () |
Get the current phase (degrees) of the body based on the position and velocity retreived from GE. | |
Vector3[] | GetPositionsForRadius (double radius) |
Get the positions where the orbit is at a specified radius. In general there are two. The result is positions in world space. These can then be used in e.g. TimeOfFlight. | |
void | SetPositionDouble (Vector3d pos) |
void | InitNBody (float physicalScale, float massScale) |
Inits the N body. Called prior to evolution starting. Allows NBody object to adjust its position and velocity prior to evolution beginning. | |
bool | IsOnRails () |
Check if body is configured at scene start to be fixed. (Allows objects to be optionally configured as not fixed, to allow e.g. Kepler eqn vs initial velocity in OrbitEllipse) | |
void | PreEvolve (float physicalScale, float massScale) |
Called for each NBody object prior to evolution beginning. Allows a chance to setup internal state. | |
void | Evolve (double physicsTime, GravityState gravityState, ref double[] r, ref double[] v, bool isQuery=false) |
Evolve the NBody. Implementating method uses physics time and scale to compute the new position, placing it in r. Velocity is also updated so that GetVelocity() can request it if it is of interest. | |
void | GEUpdate (GravityEngine ge) |
Perform and update of the world game object position and velocity based on the internal state. | |
void | Move (Vector3 position) |
Handle dynamic origin shift. | |
void | SetNBody (NBody nbody) |
Set the NBody that the orbit element will evolve. This is not commonly used, since the NBody is typically attached to the same game object as the FixedOrbit. The exception is when fixed orbit segments are part of a KeplerSequence (patched-conic evolution). | |
Vector3 | ApplyImpulse (Vector3 impulse) |
ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this) | |
NBody | GetCenterNBody () |
Return the center NBody for the fixed orbit. | |
void | UpdatePositionAndVelocity (Vector3 pos, Vector3 vel) |
Update the position and velocity of the object in the orbit. | |
string | DumpInfo () |
Create a string with info for display in GEConsole. | |
Vector3[] | OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping) |
void | ApplyScale (float scale) |
Interface to apply the scale to the distance parameter of an orbit. | |
void | ApplyXZChange () |
Public Attributes | |
EvolveMode | evolveMode |
double | p = 10.0 |
double | p_inspector = 10.0 |
Value of semi-parameter p from inspector (i.e. in GE selected units such as ORBITAL or SOLAR) | |
double | eccentricity |
double | inclination |
inclinataion in degrees (0..180) | |
double | omega_uc |
Omega in degress (0..360) | |
double | omega_lc |
omega in degress (0..360) | |
double | phase = 0 |
Phase in orbit in degrees. | |
double | sgp4_no |
double | sgp4_bstar |
double | pkepler_ndot = 0 |
double | pkepler_nddot = 0 |
NBody | centerNbody |
Object influencing this bodies motion. | |
InputMode | inputMode = InputMode.DOUBLE |
string | jplEphemeris = "" |
string | tleName = "" |
string | tleLine1 ="" |
string | tleLine2 ="" |
bool | dejitterCOE = false |
Vector3d | |
Protected Member Functions | |
void | CalculateRotation () |
Protected Attributes | |
Quaternion | conic_orientation |
GravityEngine | ge |
A generic double precision orbit class. Can be used in place of OrbitEllipse and OrbitHyper.
Maintains all orbital elements in double precision in internal GE units.
Supports two evolve modes: GRAVITY_ENGINE: Set initial velocity and poistion based on orbital elements and then let GE integrators move the body as time evolves.
KEPLER: Use Kepler's equation (position, velocity as a function of time) to determine when the body is each GE update. GE will still use the mass of this body to influence other bodies in the scene.
Arbitrary nesting of these modes is expected. (i.e. Kepler motion of a moon, around a GE planet in orbit around a Sun etc.)
Since the semi-major axis (a) can change sign as eccentricy changes, specify the scale of the orbit with p (semi-latus rectum).
void OrbitUniversal.AddSGP4ErrorCallback | ( | SGP4ErrorCallback | errorCallback | ) |
Callback for when an SGP4 satellite decays.
Warning: This is called from within the GE physics loop. Do not direcly call RemoveBody() while inside this code!
errorCallback |
Vector3 OrbitUniversal.ApplyImpulse | ( | Vector3 | impulse | ) |
Apply an impulse to change the on-rails evolution (Kepler or SGP4). OrbitUniversal supports seamless changes from ellipse to parabola to hyperbola. This updates the initial conditions and start time (r0, v0, time0)
This method is usually called from GravityEngine ApplyImpulse(). Not commonly called from game code.
impulse | Adjusted Impulse |
Implements IFixedOrbit.
|
virtual |
Interface to apply the scale to the distance parameter of an orbit.
scale | Scale. |
Implements IOrbitScalable.
Reimplemented in BinaryOrbit.
|
virtual |
Implements IOrbitScalable.
void OrbitUniversal.ChangeEvolveMode | ( | EvolveMode | newMode | ) |
Change the evolve mode between KEPLER and GRAVITY_ENGINE. i.e. go from off-rails to on-rails.
newMode |
void OrbitUniversal.CopyFromOrbitUniversal | ( | OrbitUniversal | fromOrbit | ) |
Init from another OrbitUniversal.
od |
|
virtual |
Create a string with info for display in GEConsole.
Implements IFixedOrbit.
Reimplemented in BinaryOrbit.
Vector3[] OrbitUniversal.EllipseSegment | ( | int | numPoints, |
Vector3 | centerPos, | ||
Vector3 | pos, | ||
Vector3 | destPoint, | ||
bool | shortPath | ||
) |
Generate the points for an ellipse segment given the start and end positions. If shortPath then the short path between the points will be shown, otherwise the long way around.
The points are used to determine an angle from the main axis of the ellipse and although they should be on the ellipse for best results, the code will do it's best if they are not.
numPoints | |
centerPos | |
pos | |
destPoint | |
shortPath |
Vector3[] OrbitUniversal.EllipseSegmentProRetro | ( | int | numPoints, |
Vector3 | centerPos, | ||
Vector3 | pos, | ||
Vector3 | destPoint, | ||
bool | retrograde | ||
) |
Generate the points for an ellipse segment given the start and end positions.
The points are used to determine an angle from the main axis of the ellipse and although they should be on the ellipse for best results, the code will do it's best if they are not.
numPoints | |
centerPos | |
pos | |
destPoint | |
retrograde |
|
virtual |
Evolve the NBody. Implementating method uses physics time and scale to compute the new position, placing it in r. Velocity is also updated so that GetVelocity() can request it if it is of interest.
physicsTime | Current Physics time. |
physicalScale | Physical scale. |
r | Position in physics space (x, y, z). OUTPUT by the method |
v | Velocity in physics space (x, y, z). OUTPUT by the method |
isQuery | Request is a query and should not change state or do callbacks |
The SGP4 algorithm will not accurately reproduce the position and velocity for the COE elements in the TLE at time 0. This is due to the fact that some of the COE secular pertubations modifiy the COE values even when time has not evolved.
When GE wants to reset an SGP4 evolution e.g. after an impulse/maneuver it is important that the satellite does not suddenly jump to a new position or velocity. There is no way to preadjust the COE values so that with secular variations at t=0 the algorithm gives the required r. The solution is to start position/velocity calculations at t=0 using the TLE COE values and then to "Lerp" over to the secular values. The timescale for this lerping is a matter of choice. It can be fixed as an absolute time or can be expressed as a factor of the orbital period of the satellite. This "Lerp setting" is selected globally in the GE advanced foldout.
Implements IFixedOrbit.
Reimplemented in BinaryOrbit.
|
virtual |
Evolve using the Simplified General Pertubation propagator model V4.
See: https://en.wikipedia.org/wiki/Simplified_perturbations_models
physicsTime | |
gravityState | |
r_new | |
v_new |
double OrbitUniversal.GetApogee | ( | ) |
Determine the orbit apogee (apoapsis) is internal physics units.
Typically used for an ellipse. For a hyperbola will be a negative number.
double OrbitUniversal.GetApogeeInspector | ( | ) |
Get the apogee (point of greatest distance from focus) for the orbit in Scaled units (e.g. ORBITAL). This is typically used in the inspector prior to the game starting.
Typically used for an ellipse. For a hyperbola will be a negative number.
Vector3d OrbitUniversal.GetAxis | ( | ) |
Get the normal vector to the orbital plane (normalized).
NBody OrbitUniversal.GetCenterNBody | ( | ) |
OrbitUtils.OrbitElements OrbitUniversal.GetCurrentOrbitalElements | ( | ) |
Get the current orbital elements using the live position and velocity from GE.
double OrbitUniversal.GetCurrentPhase | ( | ) |
Get the current phase (degrees) of the body based on the position and velocity retreived from GE.
double OrbitUniversal.GetEnergy | ( | ) |
Compute a real-time value for the orbital energy based on (r,v)
double OrbitUniversal.GetMajorAxis | ( | ) |
Get the Major Axis is internal physical units. If the orbit is an ellipse the major axis is valid. If the orbit is a hyperbola, then the value of p will be negative and there is no major axis value.
double OrbitUniversal.GetMajorAxisInspector | ( | ) |
Get the major axis for the orbit using the inspector value (world units).
double OrbitUniversal.GetPerigee | ( | ) |
Determine the orbit preigee (periapsis) is internal physics units.
double OrbitUniversal.GetPerigeeInspector | ( | ) |
Get the perigee (point of closest approach to the focus) for the orbit in Scaled units (e.g. ORBITAL). This is typically used in the inspector prior to the game starting.
Valid for all orbit types.
float OrbitUniversal.GetPhaseDegForRadius | ( | double | radius | ) |
Get the phase for the specified radius/altitude.
In the case of an ellipse if the altitute larger/smaller than those allowed just return the max. An ellipse will have two values that match the altitude. To get the alternative one use (360 - phase).
A circular orbit will return a phase of zero for any altitude.
radius |
Vector3d OrbitUniversal.GetPositionDForThetaRadians | ( | double | thetaRadians, |
bool | relative | ||
) |
Determine orbit position in physics space (with rotation and center offset) for the specified angle in the orbit (in radians)
Common code works for ellipse and hyperbola, but not a parabola. Nudge a parabola into hyperbola
thetaRadians | |
relative |
Vector3 OrbitUniversal.GetPositionForThetaRadians | ( | float | thetaRadians, |
Vector3 | centerPos | ||
) |
Determine orbit position in physics space (with rotation and center offset) for the specified angle in the orbit (in radians)
Common code works for ellipse and hyperbola, but not a parabola. Nudge a parabola into hyperbola
thetaRadians | |
centerPos |
Vector3[] OrbitUniversal.GetPositionsForRadius | ( | double | radius | ) |
Get the positions where the orbit is at a specified radius. In general there are two. The result is positions in world space. These can then be used in e.g. TimeOfFlight.
Use the general equation for hyperbola and ellipse and nudge a parabola into a hyperbola.
radius |
Vector3[] OrbitUniversal.GetPositionsForRadius | ( | double | radius, |
Vector3 | centerPos | ||
) |
Get the positions where the orbit is at a specified radius. In general there are two. The result is positions in world space. These can then be used in e.g. TimeOfFlight.
Use the general equation for hyperbola and ellipse and nudge a parabola into a hyperbola.
radius |
Get the intial conditions for the orbit. R0 and V0 are always relative to the center body. If the center is not at (0,0,0) and/or moving, need to adjust values outside.
These value are always available (even if orbitU was not inited with InitRVT).
r0 | |
v0 | |
time0 |
void OrbitUniversal.GEUpdate | ( | GravityEngine | ge | ) |
Perform and update of the world game object position and velocity based on the internal state.
Implements IFixedOrbit.
Vector3[] OrbitUniversal.HyperSegmentSymmetric | ( | int | numPoints, |
Vector3 | centerPos, | ||
float | radiusOrZero, | ||
bool | doSceneMapping | ||
) |
Calculate points suitable for a line renderer that show a segment of the hyperbola for a specified radius with respect to the center.
numPoints | |
centerPos | |
radius | |
doSceneMapping |
void OrbitUniversal.InitCOEFromTLEData | ( | ) |
Init the classical orbital element (COE) from Celestrak two-line element (TLE) information.
The TLE info describes the orbital parameters and position at a time reference embedded in the TLE.
It is necessary to advance the position and orbital elements to the start time (as a Julian day from GE). This is done using the SGP4 propagator.
The time since GE started is then evolved using a standard GE orbit propagator.
void OrbitUniversal.InitFromActiveNBody | ( | NBody | activeNbody, |
NBody | center, | ||
EvolveMode | mode | ||
) |
void OrbitUniversal.InitFromOrbitData | ( | OrbitData | od, |
double | time | ||
) |
Initialize the Orbit from orbital elements contained in an OrbitData object.
od |
void OrbitUniversal.InitFromRVT | ( | Vector3d | r, |
Vector3d | v, | ||
double | time, | ||
NBody | center, | ||
bool | relativePos, | ||
bool | updateState = false |
||
) |
Initialize the orbit using position, velocity and time.
Position and velocity are relative to the center object. (This is because when eg. adding a segement arount a moon in free return calculations cannot assume we mean the current position of the center).
r | relative position wrt center |
v | relative velocity wrt center |
time | |
center |
void OrbitUniversal.InitFromSolarBody | ( | SolarBody | sbody | ) |
Inits from solar body. This will always be an ellipse.
sbody | Sbody. |
|
virtual |
Inits the N body. Called prior to evolution starting. Allows NBody object to adjust its position and velocity prior to evolution beginning.
physicalScale | Physical scale. |
Implements INbodyInit.
Reimplemented in BinaryOrbit.
|
virtual |
Check if body is configured at scene start to be fixed. (Allows objects to be optionally configured as not fixed, to allow e.g. Kepler eqn vs initial velocity in OrbitEllipse)
true
if this instance is fixed; otherwise, false
.Implements IFixedOrbit.
Reimplemented in BinaryOrbit.
void OrbitUniversal.LockAtTime | ( | double | lockTime | ) |
Use in On-Rails mode to lock an object at a specific time. Any evolve calls will not re-compute the position/velocity but instead leave them unchanged.
This will be applied to the orbit for the world state. If trajectory prediction is being used this will result in the locked times being returned for the trajectory - this will be wrong.
Do not use when trajectory prediction is enabled.
lockTime |
void OrbitUniversal.Move | ( | Vector3 | position | ) |
Move in response to a GE.MoveAll() call. (Not called from outside GE).
Since the next time Evolve() is called it will get a new center, no need to change the position here.
position |
Implements IFixedOrbit.
Vector3[] OrbitUniversal.OrbitPositions | ( | int | numPoints, |
Vector3 | centerPos, | ||
bool | doSceneMapping | ||
) |
Implements IOrbitPositions.
Vector3 OrbitUniversal.PositionForPhase | ( | float | phaseDeg | ) |
Get the position for the specified phase in physics co-ordinates.
(If map to scene is being used it up to the caller to do the conversion using ge.MapToScene() )
phaseDeg |
OrbitUtils.OrbitElements.TypeOrbit OrbitUniversal.PredictedOrbitType | ( | ) |
When this OrbitU is being used as an orbit predictor report the last type that was determined by the RVtoCOE.
|
virtual |
Called for each NBody object prior to evolution beginning. Allows a chance to setup internal state.
physicalScale | Physical scale. |
massScale | Mass scale. |
Implements IFixedOrbit.
Reimplemented in BinaryOrbit.
OrbitPredictor does not need to do a full re-init, just use RV to set new COE.
r | |
v | |
time |
void OrbitUniversal.Reset | ( | ) |
Reset the OrbitPredictor init mode.
Current use case is test code that re-uses OUs. Some maneuvers may have set this.
Utility function (used by e.g. OrbitPredictor) to see if the orbit initial conditions have changed. Used to determine when an OP needs to recompute the orbit in KEPLER mode.
r0 | |
v0 | |
time0 | |
tol |
void OrbitUniversal.SetMajorAxisInspector | ( | double | a | ) |
For ellipses can specify size using major-axis. Typically used by editor script, but may have other uses.
a |
void OrbitUniversal.SetMu | ( | double | mu | ) |
void OrbitUniversal.SetNBody | ( | NBody | nbody | ) |
Set the NBody that the orbit element will evolve. This is not commonly used, since the NBody is typically attached to the same game object as the FixedOrbit. The exception is when fixed orbit segments are part of a KeplerSequence (patched-conic evolution).
nbody |
Implements IFixedOrbit.
void OrbitUniversal.SetNewCenter | ( | NBody | newCenter | ) |
Set a new center object. Used when doing Kepler ("on-rails") evolution and the object enters the sphere of influence of a new body. The inital conditions (r0,v0, t0) are updated to be with respect to the new center object allowing Kepler evolution wrt the new center.
newCenter |
void OrbitUniversal.SetSizeWithApogeePerigee | ( | double | apogee, |
double | perigee | ||
) |
Set the size and eccentricity of the ellipse by using values for apogee and perigee. (To be precise really should call them apoapsis and periapsis, but more people will know apogee/perigee).
Typically only used for ellipses (but can work for hyperbolas) by the Editor script for this component.
Values provided are in GE scaled units (e.g. ORBITAL)
apogee | |
perigee |
delegate void OrbitUniversal.SGP4ErrorCallback | ( | OrbitUniversal | ou, |
int | error | ||
) |
In SGP4 propagation the satellite can decay to the point where it should not be propagated. Users may wish to trigger a callback on this event. This allows for a callback to be registered.
ou |
Determine the time of flight in physics time units (GE internal time) that it takes for the body in orbit to go from relative position r0 to position r1.
r0 | from relative position (assumes center is (0,0,0) |
r1 | to relative position |
Find the time of flight from position r0 to r1 when the orbit is elliptical.
Will issue a warning and return 0 when the orbit in not elliptical.
r0 | |
r1 |
void OrbitUniversal.UpdatePositionAndVelocity | ( | Vector3 | pos, |
Vector3 | vel | ||
) |
Set a new start position for orbit evolution with respect to the current center object.
pos | |
vel |
Implements IFixedOrbit.
Vector3 OrbitUniversal.VelocityForPhaseRelative | ( | float | phaseDeg | ) |
Uses Vallado, Algorithm 10 for (x,y) plane and then rotates into place
Vector3 OrbitUniversal.VelocityForPosition | ( | Vector3 | position | ) |
Given a position on the orbit (or a position that is used to establish a phase wrt the center) determine the velocity vector at that point on the orbit.
position |
double OrbitUniversal.p = 10.0 |
semi-parameter that defines orbit size in GE internal units. For a universal orbit p is needed. See SetMajorAxis() if a is needed.