Gravity Engine 12.0
Unity Asset for Gravity
|
Interface defining the fixed motion of an NBody object. More...
Public Member Functions | |
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. | |
Interface defining the fixed motion of an NBody object.
Scripts implementing this interface must be attached to a game object that also has an NBody component.
Objects with fixed motion will have their mass used to create the global gravitational field but will not be affected by that field. Their motion is defined by the Evolve() method. When called they are responsible for updating their position.
Vector3 IFixedOrbit.ApplyImpulse | ( | Vector3 | impulse | ) |
ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this)
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
string IFixedOrbit.DumpInfo | ( | ) |
Create a string with info for display in GEConsole.
Implemented in BinaryOrbit, OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.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.
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 |
Implemented in BinaryOrbit, OrbitUniversal, FixedObject, OrbitPoint, KeplerSequence, OrbitEllipse, and OrbitHyper.
NBody IFixedOrbit.GetCenterNBody | ( | ) |
Return the center NBody for the fixed orbit.
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.GEUpdate | ( | GravityEngine | ge | ) |
Perform and update of the world game object position and velocity based on the internal state.
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
bool IFixedOrbit.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
.Implemented in BinaryOrbit, OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.Move | ( | Vector3 | position | ) |
Handle dynamic origin shift.
position |
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.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. |
Implemented in BinaryOrbit, OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.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 |
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.
void IFixedOrbit.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 |
Implemented in OrbitEllipse, OrbitHyper, FixedObject, KeplerSequence, OrbitPoint, and OrbitUniversal.