Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
OrbitPoint Class Reference

OrbitPoint places an object at a specified location on the orbit. The location can be specified in various ways according to the PointType enum. More...

Inheritance diagram for OrbitPoint:
IFixedOrbit INbodyInit

Public Types

enum  PointType {
  APOAPSIS , PERIAPSIS , ALTITUDE_1ST , ALTITUDE_2ND ,
  ASCENDING_NODE , DESCENDING_NODE , FIXED_TIME , PHASE ,
  PHASE_FROM_MOUSE
}
 

Public Member Functions

void Init ()
 
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.
 
void SetOrbitPredictor (OrbitPredictor op)
 
void SetPointType (PointType ptype)
 
void SetPointData (double data)
 
OrbitUniversal GetOrbit ()
 
float GetPhase ()
 
NBody GetNBody ()
 
void SetTimeRefBody (NBody refBody)
 
void SetSceneCamera (Camera c)
 
double TimeToOrbitPoint (NBody fromNbody)
 Get the time required to move to the current orbit point position in GE internal time.
 
void SetTime (NBody refBody, double time)
 Set the orbit point position based on the position of the provided NBody evolved into the future by the value of time.
 
float MouseDistanceToShip ()
 
bool HandleMouseInput ()
 Handle mouse input and return true if this resulted in a change of position.
 
void SetMouseControl (bool control)
 Set the flag that enables mouse checking in the Update loop. In some cases this may be delegated to a controller class e.g. TransferSceneContoller in TransferWithOrbitPoint scene.
 
void SetMousePhase (float phase)
 Set the initial phase for the PHASE_FROM_MOUSE mode. Typically set to a few degrees ahead of the ship position so that it is visually distinct from the ship.
 
void DoUpdate (bool init)
 
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 gs, ref double[] r, ref double[] v, bool doCallbacks=true)
 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.
 
Vector3 GetVelocity ()
 
Vector3 GetPosition ()
 
Vector3d GetPositionDouble ()
 
Vector3d GetPositionDoubleV3 ()
 
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.
 
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 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.
 

Public Attributes

bool mouseControl = true
 
OrbitPredictor orbitPredictor = null
 
PointType pointType = PointType.APOAPSIS
 
double pointData = 0.0
 data field to be used with fixed time, altitude or phase point types
 
NBody timeRefBody = null
 
Camera sceneCamera = null
 Camera reference is only required if using PHASE_FROM_MOUSE.
 

Detailed Description

OrbitPoint places an object at a specified location on the orbit. The location can be specified in various ways according to the PointType enum.

The game object to which this component is attached will be placed at the specified location.

If the script is attached to an NBody element it will set the position and velocity of the NBody element based on the values at the specified point of the orbit. This requires that the NBody attached has been added to GE.

Member Function Documentation

◆ ApplyImpulse()

Vector3 OrbitPoint.ApplyImpulse ( Vector3  impulse)

ApplyImpulse in Kepler mode. (Currently only OrbitUniversal does this)

Returns

Implements IFixedOrbit.

◆ DumpInfo()

string OrbitPoint.DumpInfo ( )

Create a string with info for display in GEConsole.

Returns

Implements IFixedOrbit.

◆ Evolve()

void OrbitPoint.Evolve ( double  physicsTime,
GravityState  gravityState,
ref double[]  r,
ref double[]  v,
bool  isQuery = true 
)

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.

Parameters
physicsTimeCurrent Physics time.
physicalScalePhysical scale.
rPosition in physics space (x, y, z). OUTPUT by the method
vVelocity in physics space (x, y, z). OUTPUT by the method
isQueryRequest is a query and should not change state or do callbacks

Implements IFixedOrbit.

◆ GetCenterNBody()

NBody OrbitPoint.GetCenterNBody ( )

Return the center NBody for the fixed orbit.

Returns

Implements IFixedOrbit.

◆ GEUpdate()

void OrbitPoint.GEUpdate ( GravityEngine  ge)

Perform and update of the world game object position and velocity based on the internal state.

Implements IFixedOrbit.

◆ HandleMouseInput()

bool OrbitPoint.HandleMouseInput ( )

Handle mouse input and return true if this resulted in a change of position.

Returns

◆ InitNBody()

void OrbitPoint.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.

Parameters
physicalScalePhysical scale.

Implements INbodyInit.

◆ IsOnRails()

bool OrbitPoint.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)

Returns
true if this instance is fixed; otherwise, false.

Implements IFixedOrbit.

◆ Move()

void OrbitPoint.Move ( Vector3  position)

Handle dynamic origin shift.

Parameters
position

Implements IFixedOrbit.

◆ PreEvolve()

void OrbitPoint.PreEvolve ( float  physicalScale,
float  massScale 
)

Called for each NBody object prior to evolution beginning. Allows a chance to setup internal state.

Parameters
physicalScalePhysical scale.
massScaleMass scale.

Implements IFixedOrbit.

◆ SetMouseControl()

void OrbitPoint.SetMouseControl ( bool  control)

Set the flag that enables mouse checking in the Update loop. In some cases this may be delegated to a controller class e.g. TransferSceneContoller in TransferWithOrbitPoint scene.

Parameters
control

◆ SetMousePhase()

void OrbitPoint.SetMousePhase ( float  phase)

Set the initial phase for the PHASE_FROM_MOUSE mode. Typically set to a few degrees ahead of the ship position so that it is visually distinct from the ship.

Parameters
phase

◆ SetNBody()

void OrbitPoint.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).

Parameters
nbody

Implements IFixedOrbit.

◆ SetTime()

void OrbitPoint.SetTime ( NBody  refBody,
double  time 
)

Set the orbit point position based on the position of the provided NBody evolved into the future by the value of time.

Only valid when mode is FIXED_TIME.

Parameters
time

◆ TimeToOrbitPoint()

double OrbitPoint.TimeToOrbitPoint ( NBody  fromNbody)

Get the time required to move to the current orbit point position in GE internal time.

Parameters
fromNbody
Returns

◆ UpdatePositionAndVelocity()

void OrbitPoint.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.

Parameters
pos
vel

Implements IFixedOrbit.


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