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

DEPREACTED: Please use OrbitUniversal 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.
 
void SetCenterBody (GameObject centerBody)
 Sets the center body and initializes the ellipse configuration.
 
void InitFromOrbitData (OrbitData od)
 Inits an EllipseBase orbit from orbital parameters contained in an OrbitData.
 
OrbitData GetOrbitData ()
 
void SetInitialPosition (NBody nbody)
 Sets the initial position based on the orbit parameters. Used in the init phase to set the NBody in the correct position in the scene before handing control GE.
 
Vector3[] OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping)
 Calculate an array of points that describe the specified orbit.
 
Vector3[] OrbitSegmentPositions (int numPoints, Vector3 centerPos, Vector3 startPos, Vector3 endPos, bool shortPath)
 Generate the points for an orbit segment given the start and end positions. If shortPath then the short path between the points will be shown, otherwise the long way around.
 
GameObject GetCenterObject ()
 Return the center object around which this ellipse is defined.
 
Vector3[] OrbitPositions (int numPoints, Vector3 centerPos, bool doSceneMapping)
 

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.
 
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
 
NBody centerNbody
 
OrbitData initData
 

Detailed Description

DEPREACTED: Please use OrbitUniversal 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

◆ GetCenterObject()

GameObject EllipseBase.GetCenterObject ( )

Return the center object around which this ellipse is defined.

Returns
The center object.

◆ InitFromOrbitData()

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.

◆ OrbitPositions()

Vector3[] EllipseBase.OrbitPositions ( int  numPoints,
Vector3  centerPos,
bool  doSceneMapping 
)

Calculate an array of points that describe the specified orbit.

Returns
The positions.
Parameters
numPointsNumber points.

Implements IOrbitPositions.

◆ OrbitSegmentPositions()

Vector3[] EllipseBase.OrbitSegmentPositions ( int  numPoints,
Vector3  centerPos,
Vector3  startPos,
Vector3  endPos,
bool  shortPath 
)

Generate the points for an orbit segment given the start and end positions. If shortPath then the short path between the points will be shown, otherwise the long way around.

The points are used to determine an angle from the main axis of the ellipse and although they should be on the ellipse for best results, the code will do it's best if they are not.

Parameters
numPoints
centerPos
startPos
endPos
shortPath
Returns

◆ SetCenterBody()

void EllipseBase.SetCenterBody ( GameObject  centerBody)

Sets the center body and initializes the ellipse configuration.

Parameters
centerBodyCenter body.

Member Data Documentation

◆ a

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: