Gravity Engine  1.5
Unity Asset for Gravity
EllipseBase Class Reference

Ellipse base. More...

Inheritance diagram for EllipseBase:
IOrbitPositions BinaryPair DustRing OrbitEllipse

Public Types

enum  ParamBy { AXIS_A, CLOSEST_P }
 

Public Member Functions

void Init ()
 Init the ellipse, verify a center body is present, determine orientation and update transform. More...
 
void SetCenterBody (GameObject centerBody)
 Sets the center body and initializes the ellipse configuration. More...
 
void InitFromOrbitData (OrbitData od)
 Inits an EllipseBase orbit from orbital parameters contained in an OrbitData. More...
 
OrbitData GetOrbitData ()
 
void SetTransform ()
 Sets the transform based on the orbit parameters. More...
 
Vector3[] OrbitPositions (int numPoints)
 Calculate an array of points that describe the specified orbit More...
 
GameObject GetCenterObject ()
 Return the center object around which this ellipse is defined. More...
 

Public Attributes

ParamBy paramBy = ParamBy.AXIS_A
 Define ellipse by semi0major axis (A) or closest approach (P)
 
GameObject centerObject
 object to orbit around (if null, will take parent game object)
 
float ecc
 eccentricity (0..1, 0=circle, 1=linear)
 
float a_scaled = -1f
 
float p_scaled
 
float a = 10f
 (a,p) hold the values for a and p in the unit system specified by the gravity engine. These are scaled and used to set a and p for game simulation based on the unit scaling system provided by gravity engine. More...
 
float p
 pericenter - based on paramBy user can specify a OR p. a = p/(1-ecc)
 
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 phase
 initial TRUE anomoly (angle wrt line from focus to closest approach)
 

Protected Member Functions

void UpdateOrbitParams ()
 
void CalculateRotation ()
 

Protected Attributes

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

Detailed Description

Ellipse base.

Base class used to handle the orbital parameters and draw the orbit path in the editor using Gizmos.

How to specify an ellipse in 3D:

size: one of a or p can be used to specify the ellipse size. a - length of semi-major axis i.e. the distance from the center of the ellipse to the farthest point p - pericenter - distance from focus of ellipse 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. Y ou 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

GameObject EllipseBase.GetCenterObject ( )

Return the center object around which this ellipse is defined.

Returns
The center object.
void EllipseBase.Init ( )

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

void EllipseBase.InitFromOrbitData ( OrbitData  od)

Inits an EllipseBase orbit from orbital parameters contained in an OrbitData.

Typically used for the creation of an EllipseBase for an OrbitPredictor and for the creation of solar system objects via SolarSystem.

Parameters
odOd.
Vector3 [] EllipseBase.OrbitPositions ( int  numPoints)

Calculate an array of points that describe the specified orbit

Returns
The positions.
Parameters
numPointsNumber points.

Implements IOrbitPositions.

void EllipseBase.SetCenterBody ( GameObject  centerBody)

Sets the center body and initializes the ellipse configuration.

Parameters
centerBodyCenter body.
void EllipseBase.SetTransform ( )

Sets the transform based on the orbit parameters.

Member Data Documentation

float EllipseBase.a = 10f

(a,p) hold the values for a and p in the unit system specified by the gravity engine. These are scaled and used to set a and p for game simulation based on the unit scaling system provided by gravity engine.

semi-major axis - based on paramBy user can specify a OR p. a = p/(1-ecc)


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