Gravity Engine 12.0
Unity Asset for Gravity
|
DEPREACTED: Please use OrbitUniversal Calculate the correct initial conditions for a specified elliptical orbit around a designated body OR moves the object in a fixed ellipse determined by Kepler's equation. More...
Public Types | |
enum | evolveType { GRAVITY_ENGINE , KEPLERS_EQN } |
Public Types inherited from EllipseBase | |
enum | ParamBy { AXIS_A , CLOSEST_P } |
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 | InitNBody (float physicalScale, float massScale) |
Inits the N body position and velocity based on the ellipse parameters and the position and velocity of the parent. | |
void | InitFromSolarBody (SolarBody sbody) |
Inits from solar body. | |
float | GetPeriod () |
void | PreEvolve (float physicalScale, float massScale) |
Called by GravityEngine to setup physics info prior to simulation Do not call this method directly. Instead ensure this object is added to the GravityEngine either by adding in a script or to the public bodies list. | |
void | Evolve (double physicsTime, GravityState gs, ref double[] r_new, ref double[] v_new, bool doCallbacks=true) |
Called from the GravityEngine on FixedUpdate cycles to determine current position of body given the physics time evolution only when mode=KEPLERS_EQN. | |
void | Move (Vector3 moveBy) |
Handle dynamic origin shift. | |
void | GEUpdate (GravityEngine ge) |
Perform and update of the world game object position and velocity based on the internal state. | |
void | ApplyScale (float scale) |
Apply scale to the orbit. This is used by the inspector scripts during scene setup. Do not use at run-time. | |
void | ApplyXZChange () |
void | Log (string prefix) |
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). | |
NBody | GetCenterNBody () |
Return the center NBody for the fixed orbit. | |
Vector3 | ApplyImpulse (Vector3 impulse) |
ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this) | |
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. | |
Public Member Functions inherited from EllipseBase | |
void | Init () |
Init the ellipse, verify a center body is present, determine orientation and update transform. | |
void | SetCenterBody (GameObject centerBody) |
Sets the center body and initializes the ellipse configuration. | |
void | InitFromOrbitData (OrbitData od) |
Inits an EllipseBase orbit from orbital parameters contained in an OrbitData. | |
OrbitData | GetOrbitData () |
void | SetInitialPosition (NBody nbody) |
Sets the initial position based on the orbit parameters. Used in the init phase to set the NBody in the correct position in the scene before handing control GE. | |
Vector3[] | OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping) |
Calculate an array of points that describe the specified orbit. | |
Vector3[] | OrbitSegmentPositions (int numPoints, Vector3 centerPos, Vector3 startPos, Vector3 endPos, bool shortPath) |
Generate the points for an orbit segment given the start and end positions. If shortPath then the short path between the points will be shown, otherwise the long way around. | |
GameObject | GetCenterObject () |
Return the center object around which this ellipse is defined. | |
Vector3[] | OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping) |
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. | |
void | ApplyScale (float scale) |
Interface to apply the scale to the distance parameter of an orbit. | |
void | ApplyXZChange () |
Static Public Member Functions | |
static float | MeanToTrueAnomoly (float m, float e) |
Convert Mean Anomoly to True Anomoly for an ellipse with eccentricity e. | |
Public Attributes | |
evolveType | evolveMode = evolveType.GRAVITY_ENGINE |
Use GRAVITY_ENGINE to evolve or move in a fixed KEPLER orbit. | |
Public Attributes inherited from EllipseBase | |
ParamBy | paramBy = ParamBy.AXIS_A |
Define ellipse by semi0major axis (A) or closest approach (P) | |
GameObject | centerObject |
object to orbit around (if null, will take parent game object) | |
float | ecc |
eccentricity (0..1, 0=circle, 1=linear) | |
float | a_scaled = -1f |
float | p_scaled |
float | a = 10f |
(a,p) hold the values for a and p in the unit system specified by the gravity engine. These are scaled and used to set a and p for game simulation based on the unit scaling system provided by gravity engine. | |
float | p |
pericenter - based on paramBy user can specify a OR p. a = p/(1-ecc) | |
float | omega_uc |
"longitude of ascending node" - angle from x-axis to line from focus to pericenter | |
float | omega_lc |
"argument of perienter" - angle from ascending node to pericenter | |
float | inclination |
inclination (degrees!) | |
float | phase |
initial TRUE anomoly (angle wrt line from focus to closest approach) | |
Additional Inherited Members | |
Protected Member Functions inherited from EllipseBase | |
void | UpdateOrbitParams () |
void | CalculateRotation () |
Protected Attributes inherited from EllipseBase | |
Quaternion | ellipse_orientation |
NBody | centerNbody |
OrbitData | initData |
DEPREACTED: Please use OrbitUniversal Calculate the correct initial conditions for a specified elliptical orbit around a designated body OR moves the object in a fixed ellipse determined by Kepler's equation.
In Gravity Engine mode the orbit will evolve based on the global gravitation field and due to interactions with other bodies the actual orbit may not be the ellipse shown in the Unity editor due to these perturbations.
In KEPLER mode the orbit will be constrained to move on the ellipse specified.
This script must be attached to a gameObject with an NBody component.
Vector3 OrbitEllipse.ApplyImpulse | ( | Vector3 | impulse | ) |
ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this)
Implements IFixedOrbit.
void OrbitEllipse.ApplyScale | ( | float | scale | ) |
Apply scale to the orbit. This is used by the inspector scripts during scene setup. Do not use at run-time.
scale | Scale. |
Implements IOrbitScalable.
void OrbitEllipse.ApplyXZChange | ( | ) |
Implements IOrbitScalable.
string OrbitEllipse.DumpInfo | ( | ) |
void OrbitEllipse.Evolve | ( | double | physicsTime, |
GravityState | gs, | ||
ref double[] | r_new, | ||
ref double[] | v_new, | ||
bool | doCallbacks = true |
||
) |
Called from the GravityEngine on FixedUpdate cycles to determine current position of body given the physics time evolution only when mode=KEPLERS_EQN.
This routine updates the game object position in game space and physics space.
Do not call this method directly.
physicsTime | Physics time. |
physicalScale | Physical scale. |
r | Reference to array into which new position is placed. |
Implements IFixedOrbit.
NBody OrbitEllipse.GetCenterNBody | ( | ) |
void OrbitEllipse.GEUpdate | ( | GravityEngine | ge | ) |
Perform and update of the world game object position and velocity based on the internal state.
Implements IFixedOrbit.
void OrbitEllipse.InitFromSolarBody | ( | SolarBody | sbody | ) |
Inits from solar body.
sbody | Sbody. |
void OrbitEllipse.InitNBody | ( | float | physicalScale, |
float | massScale | ||
) |
Inits the N body position and velocity based on the ellipse parameters and the position and velocity of the parent.
physicalScale | Physical scale. |
Implements INbodyInit.
bool OrbitEllipse.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.
|
static |
Convert Mean Anomoly to True Anomoly for an ellipse with eccentricity e.
m | Mean Anomoly. (degrees) |
e | Eccentricty. |
void OrbitEllipse.Move | ( | Vector3 | position | ) |
void OrbitEllipse.PreEvolve | ( | float | physicalScale, |
float | massScale | ||
) |
Called by GravityEngine to setup physics info prior to simulation Do not call this method directly. Instead ensure this object is added to the GravityEngine either by adding in a script or to the public bodies list.
physicalScale | Physical scale. |
Implements IFixedOrbit.
void OrbitEllipse.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 OrbitEllipse.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.