Gravity Engine 2 3.0
Loading...
Searching...
No Matches
GravityEngine2.GSDisplayOrbit Class Reference

GSDisplayOrbit: This component has several usages: 1) Display an orbit for an existing (evolving) orbit in the scene. More...

Inheritance diagram for GravityEngine2.GSDisplayOrbit:
GravityEngine2.GSDisplayObject

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)
 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 ()
 
void RVRelativeSet (double3 r, double3 v)
 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 = 200
 
- 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
 

Detailed Description

GSDisplayOrbit: This component has several usages: 1) Display an orbit for an existing (evolving) orbit in the scene.

  • assumes the body is attached to component that also has GSDisplayBody for the object for which an orbit will be drawn

2) Display an orbit for the (r, v) state specified via the inspector or (more typically) via a script.

  • this option is assumed if the displayBody is null
  • this option moves the transform of this object to the r location in the scene

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.

Member Function Documentation

◆ DisplayEnabledSet()

override void GravityEngine2.GSDisplayOrbit.DisplayEnabledSet ( bool value)
virtual

Reimplemented from GravityEngine2.GSDisplayObject.

◆ DisplayOrbit()

void GravityEngine2.GSDisplayOrbit.DisplayOrbit ( GECore ge,
GSDisplay::MapToSceneFn mapToScene,
double t,
bool alwaysUpdate = 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.

Parameters
ge
mapToScene
t

<param name=""alwaysUpdate"

◆ RVRelativeSet()

void GravityEngine2.GSDisplayOrbit.RVRelativeSet ( double3 r,
double3 v )

Set the relative R, V of the orbit display in GE units.

Parameters
r
v

The documentation for this class was generated from the following file: