Contains a set of thrust forces operating on a particular RigidBody; each thruster generates a Force at a specified location on the RigidBody with a specified direction. Thrusters can be turned on or off independently. Use setMagnitude to set an overall magnitude which multiplies all of the thrust forces.

Thrusters are set to a default location and direction of the zero vector, see Vector.ORIGIN. Use setThruster to set the actual location and direction.

See RigidBodyEventHandler for an example of how to control thrusters from key events.

TO DO be able to scale or rotate each Force independently?

Implements

Constructors

  • Parameters

    • numThrusters: number

      number of thrusters to create

    • body: RigidBody

      the RigidBody which thrust is applied to

    • magnitude: number

      the overall multiplier applied to each thrust Force.

    Returns ThrusterSet

Properties

active_: boolean[]

flags indicating which thrusters are currently firing

directions_body_: Vector[]

Direction and magnitude of thrust force, in body coords.

locations_body_: Vector[]

Location on body where thrust force is applied, in body coords.

magnitude_: number

the overall multiplier applied to each thrust Force.

rigidBody_: RigidBody

The rigidBody which thrust is applied to.

Methods

  • Returns true if any thrusters in the ThrusterSet are firing.

    Returns boolean

    true if any thrusters in the ThrusterSet are firing

  • Returns true if the given thruster is firing.

    Parameters

    • index: number

      the index number of the thruster within the array of thrusters

    Returns boolean

    true if the given thruster is firing

  • Returns direction and magnitude of thrust force, in body coords, for the given thruster. Returns default value Vector.ORIGIN if location not yet defined for that thruster.

    Parameters

    • index: number

      the index number of the desired thruster within the array of thrusters

    Returns Vector

    direction and magnitude of thrust force, in body coords

  • Returns location on body where thrust force is applied for the given thruster. Returns default value Vector.ORIGIN if location not yet defined for that thruster.

    Parameters

    • index: number

      the index number of the desired thruster within the array of thrusters

    Returns Vector

    location on body where thrust force is applied, in body coords

  • Returns overall multiplier applied to the magnitude of each thrust Force.

    Returns number

    the overall multiplier applied to each thrust Force.

  • Sets whether the given thruster is firing.

    Parameters

    • index: number

      the index number of the thruster within the array of thrusters

    • active: boolean

      whether the thruster should be firing.

    Returns ThrusterSet

    this object for chaining setters

  • Sets an overall multiplier applied to each thrust Force.

    Parameters

    • magnitude: number

      the overall multiplier to apply to each thrust Force.

    Returns ThrusterSet

    this object for chaining setters

  • Sets a thruster's location and direction.

    Parameters

    • index: number

      the index number of the thruster within the array of thrusters

    • location_body: Vector

      the location to apply the thrust force on the RigidBody, in body coordinates

    • direction_body: Vector

      the direction and magnitude of the thrust force, in body coordinates

    Returns void

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc