Gravity Engine 2 5.1
|
GSDisplayOrbit: This component has several usages: 1) Display an orbit for an existing (evolving) orbit in the scene. More...
Public Member Functions | |
override void | AddToSceneDisplay (GSDisplay gsd) |
override void | DisplayEnabledSet (bool value) |
void | DisplayOrbit (GECore ge, GSDisplay.MapToSceneFn mapToScene, double t, bool alwaysUpdate=false, bool maintainCoRo=false) |
Callback from GSDisplay to allow this code to determine the current orbit elements and create a series of points for a line renderer to display the orbit. | |
Orbital.COE | LastCOE () |
Vector3[] | OrbitPoints () |
Return the points of the orbit in display space coordinates. | |
void | RVRelativeSet (double3 r, double3 v, bool updateCOE=true) |
Set the relative R, V of the orbit display in GE units. | |
Public Member Functions inherited from GravityEngine2.GSDisplayObject | |
void | AddToSceneDisplay (GSDisplay gsd) |
bool | DisplayEnabled () |
int | DisplayId () |
void | DisplayIdSet (int id) |
GSDisplay | GSDisplay () |
Public Attributes | |
BodyInitData | bodyInitData = new BodyInitData() |
GSDisplayBody | bodyToDisplay |
GSDisplayBody | centerDisplayBody |
LineRenderer | lineR |
int | numPoints = 250 |
Public Attributes inherited from GravityEngine2.GSDisplayObject | |
int | framesBetweenUpdates = 0 |
Additional Inherited Members | |
Protected Attributes inherited from GravityEngine2.GSDisplayObject | |
bool | displayEnabled = true |
int | displayId = -1 |
int | framesUntilUpdate = 0 |
countdown until this display object shold update | |
GSDisplay | gsd |
GSDisplayOrbit: This component has several usages: 1) Display an orbit for an existing (evolving) orbit in the scene.
2) Display an orbit for the (r, v) state specified via the inspector or (more typically) via a script.
In both cases a reference to a center object is required. The orbit rendered is Keplerian i.e. it is assumed the center body is a gravitational point source and no external bodies are affecting the path of the orbit via their gravity.
Commonly a LineRenderer is also attached to the same component. If detected, the GSDisplayOrbit will configure the points in the line renderer to correspond to the points in the orbit.
External scripts can get a copy of the orbit points via GetOrbitPoints() if some other rendering approach is preferred.
The editor script for this component also draws an orbit gizmo in the editor when not playing.
|
virtual |
Reimplemented from GravityEngine2.GSDisplayObject.
void GravityEngine2.GSDisplayOrbit.DisplayOrbit | ( | GECore | ge, |
GSDisplay::MapToSceneFn | mapToScene, | ||
double | t, | ||
bool | alwaysUpdate = false, | ||
bool | maintainCoRo = false ) |
Callback from GSDisplay to allow this code to determine the current orbit elements and create a series of points for a line renderer to display the orbit.
This can be expensive and the use of the display object "framesBetweenUpdates" can be used to reduce how often this routine is called. By default GSDisplay will call it on every Update() cycle.
If maintainCoRo is true, then we must compute the orbit in the inertial frame (this is how COE is defined) and then transform to the CoRo frame.
ge | |
mapToScene | |
t | |
alwaysUpdate | |
maintainCoRo |
Vector3[] GravityEngine2.GSDisplayOrbit.OrbitPoints | ( | ) |
Return the points of the orbit in display space coordinates.
void GravityEngine2.GSDisplayOrbit.RVRelativeSet | ( | double3 | r, |
double3 | v, | ||
bool | updateCOE = true ) |
Set the relative R, V of the orbit display in GE units.
If there is a display body to track then that will be used to determine the orbit. The display body should be set to null before this is used.
r | |
v | |
updateCOE | If true, will update the COE to match the new r, v |