Class EllipticalOrbit
Object
EllipticalOrbit
- All Implemented Interfaces:
OrbitAPI
Represents an elliptical orbit path.
- Since:
- 1.9
- Author:
- LazyWizard
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatprotected SectorEntityTokenprotected final SectorEntityTokenprotected final floatprotected final floatprotected final floatprotected final floatprotected final floatprotected final float -
Constructor Summary
ConstructorsConstructorDescriptionEllipticalOrbit(SectorEntityToken focus, float startAngle, float orbitWidth, float orbitHeight, float orbitAngle, float daysPerOrbit) Creates an elliptical orbit around a focus object. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance(float amount) Called by Starsector itself - you can ignore this.floatgetAngle()Returns the current angle along the orbital path of the orbiting entity.getFocus()Returns the object we are orbiting.floatfloatReturns the offset angle of the ellipsis used as a path.floatReturns the height of the ellipsis used as a path.floatReturns the width of the ellipsis used as a path.makeCopy()voidsetAngle(float angle) Explicitly sets where along our orbital path we should be.voidsetEntity(SectorEntityToken entity) Called by Starsector itself - you can ignore this.void
-
Field Details
-
focus
-
orbitAngle
protected final float orbitAngle -
orbitWidth
protected final float orbitWidth -
orbitHeight
protected final float orbitHeight -
orbitSpeed
protected final float orbitSpeed -
offsetSin
protected final float offsetSin -
offsetCos
protected final float offsetCos -
entity
-
currentAngle
protected float currentAngle
-
-
Constructor Details
-
EllipticalOrbit
public EllipticalOrbit(SectorEntityToken focus, float startAngle, float orbitWidth, float orbitHeight, float orbitAngle, float daysPerOrbit) Creates an elliptical orbit around a focus object.- Parameters:
focus- What to orbit around.startAngle- The angle (in degrees) that the orbit will begin at. 0 degrees = right - this is not relative toorbitAngle.orbitWidth- The width of the ellipse that makes up the orbital path.orbitHeight- The height of the ellipse that makes up the orbital path.orbitAngle- The angular offset of the ellipse that makes up the orbital path.daysPerOrbit- How long it should take for us to make one orbit aroundfocus.- Since:
- 1.9
-
-
Method Details
-
getAngle
public float getAngle()Returns the current angle along the orbital path of the orbiting entity.- Returns:
- The angle of the current position along the elliptical path.
- Since:
- 1.9
-
getOrbitWidth
public float getOrbitWidth()Returns the width of the ellipsis used as a path.- Returns:
- The width of the ellipsis in su.
- Since:
- 1.9
-
getOrbitHeight
public float getOrbitHeight()Returns the height of the ellipsis used as a path.- Returns:
- The height of the ellipsis in su.
- Since:
- 1.9
-
getOrbitAngle
public float getOrbitAngle()Returns the offset angle of the ellipsis used as a path.- Returns:
- The offset of the ellipsis used as a path, in degrees.
- Since:
- 1.9
-
setAngle
public void setAngle(float angle) Explicitly sets where along our orbital path we should be.- Parameters:
angle- The angle (in degrees) along the orbital path we should be moved to.- Since:
- 1.9
-
getFocus
Returns the object we are orbiting.- Specified by:
getFocusin interfaceOrbitAPI- Returns:
- The
SectorEntityTokenwe are orbiting around.
-
setEntity
Called by Starsector itself - you can ignore this. -
advance
public void advance(float amount) Called by Starsector itself - you can ignore this. -
makeCopy
-
computeCurrentLocation
- Specified by:
computeCurrentLocationin interfaceOrbitAPI
-
getOrbitalPeriod
public float getOrbitalPeriod()- Specified by:
getOrbitalPeriodin interfaceOrbitAPI
-
updateLocation
public void updateLocation()- Specified by:
updateLocationin interfaceOrbitAPI
-