Module BrakeUnit
Brakes are elements designed to produce thrust opposite to the movement of a construct.
They can be used to slow down your construct.
Element class:
- Airbrake
- Spacebrake
Functions
activate () | Start the brake at full power (works only when run inside a cockpit or under remote control). |
deactivate () | Stops the brake (works only when run inside a cockpit or under remote control). |
isActive () | Checks if the brake is active. |
getState () | Deprecated: Returns the activation state of the brake. |
toggle () | Toggle the state of the brake. |
setThrust (thrust) | Set the thrust of the brake. |
getThrust () | Returns the current thrust of the brake. |
getMaxThrust () | Returns the maximal thrust the brake can deliver in principle, under optimal conditions. |
getCurrentMinThrust () | Returns the minimal thrust the brake can deliver at the moment (can be more than zero), which will depend on various conditions like atmospheric density, obstruction, orientataion, etc. |
getCurrentMaxThrust () | Returns the maximal thrust the brake can deliver at the moment, which might depend on various conditions like atmospheric density, obstruction, orientataion, etc. |
getMaxThrustEfficiency () | Returns the ratio between the current maximum thrust and the optimal maximum thrust. |
getThrustAxis () | Returns the brake thrust direction in construct local coordinates. |
getWorldThrustAxis () | Returns the brake thrust direction in world coordinates. |
mockGetClosure () | Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":". |
Functions
- activate ()
- Start the brake at full power (works only when run inside a cockpit or under remote control).
- deactivate ()
- Stops the brake (works only when run inside a cockpit or under remote control).
- isActive ()
-
Checks if the brake is active.
Returns:
-
0/1
1 when the brake is on.
- getState ()
-
Deprecated: Returns the activation state of the brake.
This method is deprecated: isActive should be used instead
Returns:
-
0/1
1 when the brake is on, 0 otherwise.
See also:
- toggle ()
- Toggle the state of the brake.
- setThrust (thrust)
-
Set the thrust of the brake. Note that brakes can generate a force only in the movement opposite direction.
Parameters:
- thrust float The brake thrust in newtons (limited by the maximum thrust).
- getThrust ()
-
Returns the current thrust of the brake.
Returns:
-
float
The thrust the brake is currently delivering in newtons.
- getMaxThrust ()
-
Returns the maximal thrust the brake can deliver in principle, under optimal conditions. Note that the actual
current max thrust will most of the time be less than the max thrust.
Returns:
-
float
The base max thrust of the brake in newtons.
- getCurrentMinThrust ()
-
Returns the minimal thrust the brake can deliver at the moment (can be more than zero), which will depend on
various conditions like atmospheric density, obstruction, orientataion, etc. Most of the time, this will be 0 but it
can be greater than 0.
Returns:
-
float
The current min brake thrust in newtons.
- getCurrentMaxThrust ()
-
Returns the maximal thrust the brake can deliver at the moment, which might depend on various conditions like
atmospheric density, obstruction, orientataion, etc. The actual thrust will be anything below this maxThrust, which
defines the current max capability of the brake.
Returns:
-
float
The current max brake thrust in newtons.
- getMaxThrustEfficiency ()
-
Returns the ratio between the current maximum thrust and the optimal maximum thrust.
Returns:
-
float
Usually 1 but can be lower for certain brakes.
- getThrustAxis ()
-
Returns the brake thrust direction in construct local coordinates.
Returns:
-
vec3
The brake thrust direction vector in construct local coordinates.
- getWorldThrustAxis ()
-
Returns the brake thrust direction in world coordinates.
Returns:
-
vec3
The brake thrust direction vector in world coordinates.
- mockGetClosure ()
-
Mock only, not in-game: Bundles the object into a closure so functions can be called with "." instead of ":".
Returns:
-
table
A table encompasing the api calls of object.
See also: