Gravity Engine  1.5
Unity Asset for Gravity
OrbitHyper Class Reference

More...

Inheritance diagram for OrbitHyper:
INbodyInit IOrbitPositions IOrbitScalable

Public Types

enum  evolveType { GRAVITY_ENGINE, KEPLERS_EQN }
 

Public Member Functions

void Init ()
 Init the ellipse, verify a center body is present and determine orientation. More...
 
void InitFromOrbitData (OrbitData od)
 
void SetCenterBody (GameObject centerBody)
 Sets the center body and initializes the ellipse configuration. More...
 
bool IsFixed ()
 
void InitNBody (float physicalScale, float massScale)
 Inits the N body position and velocity based on the hyperbola parameters and the position and velocity of the parent. More...
 
Vector3[] OrbitPositions (int numPoints)
 Calculate an array of orbit positions. Used by the OrbitPredictor, OrbitRenderer and Editor Gimzo to illustrate the hyperbola. More...
 
void Log (string prefix)
 
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. More...
 

Public Attributes

evolveType evolveMode = evolveType.GRAVITY_ENGINE
 Use GRAVITY_ENGINE to evolve or move in a fixed KEPLER orbit.
 
GameObject centerObject
 object to orbit around (if null, will take parent game object)
 
float ecc = 2.0f
 eccentricity (0..1, 0=circle, 1=linear)
 
float perihelion = 10f
 Hyperbola parameters: The definition is typically in terms of perihelion but the hyperbola equation uses a. More...
 
float perihelion_scaled = 10f
 point of closest approach
 
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 r_initial = 10f
 initial distance from focus
 
bool r_initial_outbound = false
 initial distance on outbound leg
 

Protected Member Functions

void CalcOrbitParams ()
 
void CalculateRotation ()
 

Protected Attributes

Quaternion ellipse_orientation
 
Vector3 xunit = Vector3.right
 
Vector3 yunit = Vector3.up
 
Vector3 zunit = Vector3.forward
 
NBody centerNbody
 

Detailed Description

Class used to handle the hyperbolic orbital parameters and draw the orbit path in the editor using Gizmos.

How to specify an hyperbola in 3D:

p - pericenter - distance from focus of hyperbola to point of closest approach to that focus

shape: controlled by ecc (eccentricity) 0 for a circle, 0.99 for a very long thin ellipse

orientation: The standard orbit parameters are used. You can develop some intuition for these by chaging them in the Editor and observing the change in the orbit.

Orientation is defined with respect to the positive X axis. omega (lower case) - is a rotation in the plane of the orbit Inclination - is the tilt of the closest approach vector to the XY plance Omega (capital Omega) - is the rotation around Z after preceeding rotations

Member Function Documentation

void OrbitHyper.ApplyScale ( float  scale)

Apply scale to the orbit. This is used by the inspector scripts during scene setup. Do not use at run-time.

Parameters
scaleScale.

Implements IOrbitScalable.

void OrbitHyper.Init ( )

Init the ellipse, verify a center body is present and determine orientation.

void OrbitHyper.InitNBody ( float  physicalScale,
float  massScale 
)

Inits the N body position and velocity based on the hyperbola parameters and the position and velocity of the parent.

Parameters
physicalScalePhysical scale.

Implements INbodyInit.

Vector3 [] OrbitHyper.OrbitPositions ( int  numPoints)

Calculate an array of orbit positions. Used by the OrbitPredictor, OrbitRenderer and Editor Gimzo to illustrate the hyperbola.

Returns
The positions.
Parameters
numPointsNumber points.

Implements IOrbitPositions.

void OrbitHyper.SetCenterBody ( GameObject  centerBody)

Sets the center body and initializes the ellipse configuration.

Parameters
centerBodyCenter body.

Member Data Documentation

float OrbitHyper.perihelion = 10f

Hyperbola parameters: The definition is typically in terms of perihelion but the hyperbola equation uses a.

a is calculated from the perihelion and used for orbital calculations.

point of closest approach


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