Module GyroUnit
A general kinematic unit to obtain information about the ship orientation, velocity, and acceleration.
Element class: GyroUnit
Extends: Element > ElementWithState > ElementWithToggle
Functions
| activate () | Sets this gyro as the main gyro used for ship orientation. |
| deactivate () | Deselects this gyro as the main gyro used for ship orientation, using the core unit instead. |
| toggle () | Toggle the activation state of the gyro. |
| isActive () | Returns the activation state of the gyro. |
| getWidgetData () | Get element data as JSON. |
| localUp () | Deprecated: The up vector of the gyro unit, in construct local coordinates. |
| localForward () | Deprecated: The forward vector of the gyro unit, in construct local coordinates. |
| localRight () | Deprecated: The right vector of the gyro unit, in construct local coordinates. |
| worldUp () | Deprecated: The up vector of the gyro unit, in world coordinates. |
| worldForward () | Deprecated: The forward vector of the gyro unit, in world coordinates. |
| worldRight () | Deprecated: The right vector of the gyro unit, in world coordinates. |
| getPitch () | The pitch value relative to the gyro orientation and the local gravity. |
| getRoll () | The roll value relative to the gyro orientation and the local gravity. |
Functions
- activate ()
-
Sets this gyro as the main gyro used for ship orientation.
Note: Has no effect when called on a static core.
- deactivate ()
- Deselects this gyro as the main gyro used for ship orientation, using the core unit instead.
- toggle ()
-
Toggle the activation state of the gyro.
Note: Has no effect when called on a static core.
- isActive ()
-
Returns the activation state of the gyro.
Returns:
-
0/1
1 when the gyro is the active ship orientation, 0 otherwise.
- getWidgetData ()
-
Get element data as JSON.
Gyroscopes have a
gyrowidget, which contains the following fields (bold fields are visible when making custom use of the widget):- pitch (float) Pitch angle in degrees.
- roll (float) Roll angle in degrees.
- name (string) The name of the element.
- helperId (string)
gyro - type (string)
gyro
Returns:
-
string
Data as JSON.
- localUp ()
-
Deprecated: The up vector of the gyro unit, in construct local coordinates.
This method is deprecated: Element.getUp should be used instead
Returns:
-
Normalized up vector of the gyro unit, in construct local coordinates.
See also:
- localForward ()
-
Deprecated: The forward vector of the gyro unit, in construct local coordinates.
This method is deprecated: Element.getForward should be used instead
Returns:
-
Normalized forward vector of the gyro unit, in construct local coordinates.
See also:
- localRight ()
-
Deprecated: The right vector of the gyro unit, in construct local coordinates.
This method is deprecated: Element.getRight should be used instead
Returns:
-
Normalized right vector of the gyro unit, in construct local coordinates.
See also:
- worldUp ()
-
Deprecated: The up vector of the gyro unit, in world coordinates.
This method is deprecated: Element.getWorldUp should be used instead
Returns:
-
Normalized up vector of the gyro unit, in world coordinates.
See also:
- worldForward ()
-
Deprecated: The forward vector of the gyro unit, in world coordinates.
This method is deprecated: Element.getWorldForward should be used instead
Returns:
-
Normalized forward vector of the gyro unit, in world coordinates.
See also:
- worldRight ()
-
Deprecated: The right vector of the gyro unit, in world coordinates.
This method is deprecated: Element.getWorldRight should be used instead
Returns:
-
Normalized right vector of the gyro unit, in world coordinates.
See also:
- getPitch ()
-
The pitch value relative to the gyro orientation and the local gravity.
Returns:
-
float
The pitch angle in degrees, relative to the gyro orientation and the local gravity.
- getRoll ()
-
The roll value relative to the gyro orientation and the local gravity.
Returns:
-
float
The roll angle in degrees, relative to the gyro orientation and the local gravity.