Gravity Engine 12.0
Unity Asset for Gravity
|
Orbit predictor. An in-scene object that will determine the future orbit based on either: the current position and velocity current position and velocity from script position and velocity from script. More...
Public Member Functions | |
bool | IsConfigured () |
void | Init () |
void | SetNBody (NBody nbody) |
void | SetCenterObject (GameObject newCenterBody) |
void | SetPosition (Vector3 v) |
void | SetPosition (Vector3d v) |
void | SetVelocity (Vector3 v) |
void | SetVelocity (Vector3d v) |
void | SetFromScriptFlags (bool posFlag, bool velFlag) |
Vector3 | GetVelocity () |
Vector3d | GetVelocityV3 () |
OrbitUniversal | GetOrbitUniversal () |
double | GetCurrentPhase () |
void | TestRunnerSetup () |
Test method to allow setup for unit tests. | |
void | UpdateOrbitU (bool firstTime=false) |
Using the current position and velocity re-init the OrbitU used by the predictor to determine the current orbital elements for prediction. | |
void | DoUpdate () |
Public Attributes | |
int | numPoints = 100 |
Number of points to be used in the line renderer for the orbit plot. | |
GameObject | body |
The body for which an orbit is to be predicted. | |
GameObject | centerBody |
The object which body is in orbit around. | |
bool | velocityFromScript = false |
Script code will set the velocity explicitly. Do not retreive automatically. | |
bool | positionFromScript = false |
Script code will set the velocity explicitly. Do not retreive automatically. | |
bool | showSegment = false |
Use an additional line renderer to show a segement of the orbit to a specified. | |
bool | segmentFoldout = false |
GameObject | segmentEnd = null |
LineRenderer | segementLineR = null |
bool | retrograde = false |
float | hyperDisplayRadius = 100 |
display radius for hyperbola. If zero will use position of body and show segments from body to +/- periapsis | |
int | numPlaneProjections |
Vector3 | planeNormal = Vector3.forward |
Vector3 | editorPos = Vector3.zero |
Preserve initial values from editor. | |
Vector3 | editorVel = Vector3.zero |
Vector3d | velocity = Vector3d.zero |
velocity of body when set explicitly by script | |
Vector3d | position = Vector3d.zero |
position of body when set explicitly by script | |
bool | dejitterCOE = false |
Orbit predictor. An in-scene object that will determine the future orbit based on either: the current position and velocity current position and velocity from script position and velocity from script.
In the last case, the orbit predictor need not have an NBody specified.
Depending on the velocity the orbit may be an ellipse or a hyperbola. This class use an OrbitUniversal, since it can handle both cases.
Orbit prediction is based on the two-body problem and is with respect to one other body (presumably the dominant source of gravity for the affected object). The OrbitPredictor will create an OrbitUniversal and update the classical orbital elements (COE) based on the current position and velocity on each Update() cycle.
The orbital elements can be retreived from the OrbitUniversal via e.g orbitPredictor.GetOrbitUniversal().eccentricity
The general N-body orbit prediction problem is significantly harder - it requires simulating the entire scene into the future - re-computing whenever user input is provided. This is provided by the Trajectory prediction sub-system.
void OrbitPredictor.UpdateOrbitU | ( | bool | firstTime = false | ) |
Using the current position and velocity re-init the OrbitU used by the predictor to determine the current orbital elements for prediction.
firstTime is definitly icky, but does save a lot of duplication in OrbitU code