Gravity Engine 12.0
Unity Asset for Gravity
|
OrbitPoint places an object at a specified location on the orbit. The location can be specified in various ways according to the PointType enum. More...
Public Types | |
enum | PointType { APOAPSIS , PERIAPSIS , ALTITUDE_1ST , ALTITUDE_2ND , ASCENDING_NODE , DESCENDING_NODE , FIXED_TIME , PHASE , PHASE_FROM_MOUSE } |
Public Member Functions | |
void | Init () |
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 | SetOrbitPredictor (OrbitPredictor op) |
void | SetPointType (PointType ptype) |
void | SetPointData (double data) |
OrbitUniversal | GetOrbit () |
float | GetPhase () |
NBody | GetNBody () |
void | SetTimeRefBody (NBody refBody) |
void | SetSceneCamera (Camera c) |
double | TimeToOrbitPoint (NBody fromNbody) |
Get the time required to move to the current orbit point position in GE internal time. | |
void | SetTime (NBody refBody, double time) |
Set the orbit point position based on the position of the provided NBody evolved into the future by the value of time. | |
float | MouseDistanceToShip () |
bool | HandleMouseInput () |
Handle mouse input and return true if this resulted in a change of position. | |
void | SetMouseControl (bool control) |
Set the flag that enables mouse checking in the Update loop. In some cases this may be delegated to a controller class e.g. TransferSceneContoller in TransferWithOrbitPoint scene. | |
void | SetMousePhase (float phase) |
Set the initial phase for the PHASE_FROM_MOUSE mode. Typically set to a few degrees ahead of the ship position so that it is visually distinct from the ship. | |
void | DoUpdate (bool init) |
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 gs, ref double[] r, ref double[] v, bool doCallbacks=true) |
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. | |
Vector3 | GetVelocity () |
Vector3 | GetPosition () |
Vector3d | GetPositionDouble () |
Vector3d | GetPositionDoubleV3 () |
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. | |
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. | |
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. | |
Public Attributes | |
bool | mouseControl = true |
OrbitPredictor | orbitPredictor = null |
PointType | pointType = PointType.APOAPSIS |
double | pointData = 0.0 |
data field to be used with fixed time, altitude or phase point types | |
NBody | timeRefBody = null |
Camera | sceneCamera = null |
Camera reference is only required if using PHASE_FROM_MOUSE. | |
OrbitPoint places an object at a specified location on the orbit. The location can be specified in various ways according to the PointType enum.
The game object to which this component is attached will be placed at the specified location.
If the script is attached to an NBody element it will set the position and velocity of the NBody element based on the values at the specified point of the orbit. This requires that the NBody attached has been added to GE.
Vector3 OrbitPoint.ApplyImpulse | ( | Vector3 | impulse | ) |
ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this)
Implements IFixedOrbit.
string OrbitPoint.DumpInfo | ( | ) |
void OrbitPoint.Evolve | ( | double | physicsTime, |
GravityState | gravityState, | ||
ref double[] | r, | ||
ref double[] | v, | ||
bool | isQuery = true |
||
) |
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 |
Implements IFixedOrbit.
NBody OrbitPoint.GetCenterNBody | ( | ) |
void OrbitPoint.GEUpdate | ( | GravityEngine | ge | ) |
Perform and update of the world game object position and velocity based on the internal state.
Implements IFixedOrbit.
bool OrbitPoint.HandleMouseInput | ( | ) |
Handle mouse input and return true if this resulted in a change of position.
void OrbitPoint.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.
physicalScale | Physical scale. |
Implements INbodyInit.
bool OrbitPoint.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)
true
if this instance is fixed; otherwise, false
.Implements IFixedOrbit.
void OrbitPoint.Move | ( | Vector3 | position | ) |
void OrbitPoint.PreEvolve | ( | float | physicalScale, |
float | massScale | ||
) |
Called for each NBody object prior to evolution beginning. Allows a chance to setup internal state.
physicalScale | Physical scale. |
massScale | Mass scale. |
Implements IFixedOrbit.
void OrbitPoint.SetMouseControl | ( | bool | control | ) |
Set the flag that enables mouse checking in the Update loop. In some cases this may be delegated to a controller class e.g. TransferSceneContoller in TransferWithOrbitPoint scene.
control |
void OrbitPoint.SetMousePhase | ( | float | phase | ) |
Set the initial phase for the PHASE_FROM_MOUSE mode. Typically set to a few degrees ahead of the ship position so that it is visually distinct from the ship.
phase |
void OrbitPoint.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 OrbitPoint.SetTime | ( | NBody | refBody, |
double | time | ||
) |
Set the orbit point position based on the position of the provided NBody evolved into the future by the value of time.
Only valid when mode is FIXED_TIME.
time |
double OrbitPoint.TimeToOrbitPoint | ( | NBody | fromNbody | ) |
Get the time required to move to the current orbit point position in GE internal time.
fromNbody |
void OrbitPoint.UpdatePositionAndVelocity | ( | Vector3 | pos, |
Vector3 | vel | ||
) |
Update the position and velocity of the object in the orbit.
Currently only implemented in OrbitUniversal for changes in the center body due to patched conic transitions.
pos | |
vel |
Implements IFixedOrbit.