Module ship

This API is added by CC: VS and allows CC: Tweaked computers to access information from Valkyrien Skies Ships.

Functions

getId () Gets the Ship's ID
getSlug () Gets the Ship's unique Slug
setSlug (name) Sets the Ship's unique Slug
getMass () Gets the Ship's total mass
isStatic () Gets whether the Ship is static
getJoints () Gets the joints on the Ship
getShipyardPosition () Gets the Ship's Center of Mass in ship-local coordinates
getWorldspacePosition () Gets the Ship's Center of Mass in world coordinates
transformPositionToWorld (pos) Transforms a position from ship-local coordinates to world coordinates
getVelocity () Gets the Ship's linear velocity
getOmega () Gets the Ship's angular velocity
getScale () Gets the Ship's scale
getQuaternion () Gets the Ship's Quaternion
getTransformationMatrix () Gets the Ship's Transformation Matrix
getMomentOfInertiaTensorToSave () Gets the Moment of Inertia Tensor to be saved
getMomentOfInertiaTensor () Gets the current Moment of Inertia Tensor
pullPhysicsTicks () Pulls physics ticks for the Ship

This function blocks until the next physics tick event for the Ship is available.

Extended Ship API

setStatic (isStatic) Sets the Ship to be static or dynamic
setScale (scale) Sets the Ship's scale
teleport (data) Teleports the Ship to a new position and orientation

This function instantly moves the Ship to the specified position and orientation.

applyWorldForce (force, position) Applies a force in World Space to a ship at a World Space position.
applyWorldTorque (torque) Applies a torque in World Space to a ship at a World Space position.
applyModelForce (force, position) Applies a force in Model Space to a ship at a Model Space position.
applyModelTorque (torque) Applies a torque in Model Space to a ship at a Model Space position.
applyWorldForceToModelPos (force, position) Applies a force in World Space to a ship at a Model Space position.
applyBodyForce (force, position) Applies a force in Body Space to a ship at a Body Space position.
applyBodyTorque (torque, position) Applies a torque in Body Space to a ship at a Body Space position.
applyWorldForceToBodyPos (force, position) Applies a force in World Space to a ship at a Body Space position.

Deprecated Methods

getEulerAnglesZYX () Gets the Ship's Euler Angles in ZYX order
getEulerAnglesZXY () Gets the Ship's Euler Angles in ZXY order
getEulerAnglesYXZ () Gets the Ship's Euler Angles in YXZ order
getEulerAnglesXYZ () Gets the Ship's Euler Angles in XYZ order
getRoll () Gets the Ship's Roll angle
getYaw () Gets the Ship's Yaw angle
getPitch () Gets the Ship's Pitch angle
getRotationMatrix () Gets the Ship's Rotation Matrix
applyInvariantForce () Applies an Invariant Force to the Ship
applyInvariantTorque () Applies an Invariant Torque to the Ship
applyInvariantForceToPos () Applies an Invariant Force to a position offset from the Ship's center of mass
applyRotDependentForce () Applies a Rotation-Dependent Force to the Ship
applyRotDependentTorque () Applies a Rotation-Dependent Torque to the Ship
applyRotDependentForceToPos () Applies a Rotation-Dependent Force to a position offset from the Ship's center of mass

Physics Ticks Event Data

getBuoyancyFactor () Gets the Ship's buoyancy factor during the physics tick
isStatic () Whether the Ship is static during the physics tick
doFluidDrag () Whether the Ship is affected by fluid drag during the physics tick
getInertiaData () Gets the Ship's Inertia Data during the physics tick
getPoseVel () Gets the Ship's Pose and Velocity during the physics tick
getForceInducers () Gets the Force Inducers on the Ship during the physics tick


Functions

getId ()
Gets the Ship's ID

Returns:

    number The Ship ID

Raises:

This method errors if there is no Ship associated with the computer
getSlug ()
Gets the Ship's unique Slug

Returns:

    string The Ship's Slug

Raises:

This method errors if there is no Ship associated with the computer

See also:

setSlug (name)
Sets the Ship's unique Slug

Parameters:

  • name string The Ship's new Slug

Raises:

This method errors if there is no Ship associated with the computer

See also:

getMass ()
Gets the Ship's total mass

Returns:

    number The Ship's mass

Raises:

This method errors if there is no Ship associated with the computer
isStatic ()
Gets whether the Ship is static

Returns:

    boolean Whether the Ship is static

Raises:

This method errors if there is no Ship associated with the computer

See also:

getJoints ()
Gets the joints on the Ship

Returns:

    table A table of joints on the Ship

Raises:

This method errors if there is no Ship associated with the computer
getShipyardPosition ()
Gets the Ship's Center of Mass in ship-local coordinates

Returns:

    vector The Ship's Center of Mass in the Shipyard

Raises:

This method errors if there is no Ship associated with the computer

See also:

getWorldspacePosition ()
Gets the Ship's Center of Mass in world coordinates

Returns:

    vector The Ship's Center of Mass in Worldspace

Raises:

This method errors if there is no Ship associated with the computer

See also:

transformPositionToWorld (pos)
Transforms a position from ship-local coordinates to world coordinates

Parameters:

  • pos vector The position in ship-local coordinates

Returns:

    vector The position in world coordinates

Raises:

This method errors if there is no Ship associated with the computer
getVelocity ()
Gets the Ship's linear velocity

Returns:

    vector The Ship's linear velocity

Raises:

This method errors if there is no Ship associated with the computer

See also:

getOmega ()
Gets the Ship's angular velocity

Returns:

    vector The Ship's angular velocity

Raises:

This method errors if there is no Ship associated with the computer

See also:

getScale ()
Gets the Ship's scale

Returns:

    vector The Ship's scale

Raises:

This method errors if there is no Ship associated with the computer

See also:

getQuaternion ()
Gets the Ship's Quaternion

Returns:

    quaternion The Ship's Quaternion

Raises:

This method errors if there is no Ship associated with the computer
getTransformationMatrix ()
Gets the Ship's Transformation Matrix

Returns:

    matrix The Ship's Transformation Matrix

Raises:

This method errors if there is no Ship associated with the computer
getMomentOfInertiaTensorToSave ()
Gets the Moment of Inertia Tensor to be saved

Returns:

    matrix The Ship's Moment of Inertia Tensor

Raises:

This method errors if there is no Ship associated with the computer

See also:

getMomentOfInertiaTensor ()
Gets the current Moment of Inertia Tensor

Returns:

    matrix The Ship's Moment of Inertia Tensor

Raises:

This method errors if there is no Ship associated with the computer

See also:

pullPhysicsTicks ()
Pulls physics ticks for the Ship

This function blocks until the next physics tick event for the Ship is available. It returns the event name and the physics ticks information.

Returns:

  1. string The event name
  2. ... Physics ticks information

Raises:

This method errors if there is no Ship associated with the computer

Extended Ship API

setStatic (isStatic)
Sets the Ship to be static or dynamic

Parameters:

  • isStatic boolean Whether the Ship should be static

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
setScale (scale)
Sets the Ship's scale

Parameters:

  • scale number The new scale for the Ship

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
teleport (data)
Teleports the Ship to a new position and orientation

This function instantly moves the Ship to the specified position and orientation. It does not take into account any physics simulation and may result in unexpected behavior if the new position intersects with other objects or violates physics joints.

Note: This function may cause physics instability if used improperly. Use with caution.

Parameters:

  • data table The new position and orientation for the Ship

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it OR if this method is disabled in the configuration.
applyWorldForce (force, position)
Applies a force in World Space to a ship at a World Space position. A World Space force is independent of the ship's transform, and is always global; for example, up in World Space is ALWAYS (0, 1, 0) (as in, towards the sky), regardless of the ship's orientation.

Parameters:

  • force vector The force vector in World Space
  • position vector or nil The position in World Space where the force is applied. Defaults to the ship's center of mass in World Space

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyWorldTorque (torque)
Applies a torque in World Space to a ship at a World Space position. A World Space torque is independent of the ship's transform, and is always global; for example, up in World Space is ALWAYS (0, 1, 0) (as in, towards the sky), regardless of the ship's orientation.

Parameters:

  • torque vector The torque vector in World Space

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyModelForce (force, position)
Applies a force in Model Space to a ship at a Model Space position. A Model Space force is relative to the ship's transform, meaning that it rotates and scales with the ship; for example, a ship rotated on its side applying a force pointing to (0, 1, 0) in Model Space would be perpendicular to World Space up.

This is useful for a Thruster or similar block that should apply a force relative to the ship's orientation

Parameters:

  • force vector The force vector in Model Space
  • position vector or nil The position in Model Space where the force is applied. Defaults to the ship's center of mass in Model Space

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyModelTorque (torque)
Applies a torque in Model Space to a ship at a Model Space position. A Model Space torque is relative to the ship's transform, meaning that it rotates and scales with the ship

Parameters:

  • torque vector The torque vector in Model Space

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyWorldForceToModelPos (force, position)
Applies a force in World Space to a ship at a Model Space position. A World Space force is independent of the ship's transform, and is always global; for example, up in World Space is ALWAYS (0, 1, 0) (as in, towards the sky), regardless of the ship's orientation.

This is useful for a balloon or similar block that should apply a force relative to the world, such as always pushing up against gravity.

Parameters:

  • force vector The force vector in World Space
  • position vector The position in Model Space where the force is applied

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyBodyForce (force, position)
Applies a force in Body Space to a ship at a Body Space position. A Body Space force is positionally relative to the ship's Center of Mass, and applies relative to the ship's transform, meaning that it rotates and scales with the ship

Parameters:

  • force vector The force vector in Body Space
  • position vector or nil The position in Body Space where the force is applied. Defaults to (0,0,0), the ship's center of mass

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyBodyTorque (torque, position)
Applies a torque in Body Space to a ship at a Body Space position. A Body Space torque is positionally relative to the ship's Center of Mass, and applies relative to the ship's transform, meaning that it rotates and scales with the ship

Parameters:

  • torque vector The torque vector in Body Space
  • position vector or nil The position in Body Space where the force is applied. Defaults to (0,0,0), the ship's center of mass

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.
applyWorldForceToBodyPos (force, position)
Applies a force in World Space to a ship at a Body Space position. A World Space force is independent of the ship's transform, and is always global; for example, up in World Space is ALWAYS (0, 1, 0) (as in, towards the sky), regardless of the ship's orientation

Parameters:

  • force vector The force vector in World Space
  • position vector or nil The position in Body Space where the force is applied

Raises:

This method errors if there is no Ship associated with the computer OR if the computer is not a Command Computer and the configuration disallows it.

Deprecated Methods

getEulerAnglesZYX ()
Gets the Ship's Euler Angles in ZYX order

Raises:

This method no longer exists! Please utilize the new quaternion API!
getEulerAnglesZXY ()
Gets the Ship's Euler Angles in ZXY order

Raises:

This method no longer exists! Please utilize the new quaternion API!
getEulerAnglesYXZ ()
Gets the Ship's Euler Angles in YXZ order

Raises:

This method no longer exists! Please utilize the new quaternion API!
getEulerAnglesXYZ ()
Gets the Ship's Euler Angles in XYZ order

Raises:

This method no longer exists! Please utilize the new quaternion API!
getRoll ()
Gets the Ship's Roll angle

Raises:

This method no longer exists! Please utilize the new quaternion API!
getYaw ()
Gets the Ship's Yaw angle

Raises:

This method no longer exists! Please utilize the new quaternion API!
getPitch ()
Gets the Ship's Pitch angle

Raises:

This method no longer exists! Please utilize the new quaternion API!
getRotationMatrix ()
Gets the Ship's Rotation Matrix

Raises:

This method no longer exists! Use getTransformationMatrix instead!
applyInvariantForce ()
Applies an Invariant Force to the Ship

Raises:

This method no longer exists! Use applyWorldForceToBodyPos instead!
applyInvariantTorque ()
Applies an Invariant Torque to the Ship

Raises:

This method no longer exists! Use applyWorldTorque instead!
applyInvariantForceToPos ()
Applies an Invariant Force to a position offset from the Ship's center of mass

Raises:

This method no longer exists! Use applyBodyForce instead!
applyRotDependentForce ()
Applies a Rotation-Dependent Force to the Ship

Raises:

This method no longer exists! Use applyBodyForce instead!
applyRotDependentTorque ()
Applies a Rotation-Dependent Torque to the Ship

Raises:

This method no longer exists! Use applyBodyTorque instead!
applyRotDependentForceToPos ()
Applies a Rotation-Dependent Force to a position offset from the Ship's center of mass

Raises:

This method no longer exists! Use applyBodyForce instead!

Physics Ticks Event Data

getBuoyancyFactor ()
Gets the Ship's buoyancy factor during the physics tick

Returns:

    number The Ship's buoyancy factor
isStatic ()
Whether the Ship is static during the physics tick

Returns:

    boolean Whether the Ship is static
doFluidDrag ()
Whether the Ship is affected by fluid drag during the physics tick

Returns:

    boolean Whether the Ship has fluid drag
getInertiaData ()
Gets the Ship's Inertia Data during the physics tick

Returns:

    table The Ship's Inertia Data comprised of mass and moment of inertia tensor
getPoseVel ()
Gets the Ship's Pose and Velocity during the physics tick

Returns:

    table The Ship's Pose and Velocity data including position, rotation, linear velocity, and angular velocity
getForceInducers ()
Gets the Force Inducers on the Ship during the physics tick

Returns:

    table A table of Force Inducers on the Ship
generated by LDoc 1.5.0 Last updated 2025-12-25 15:07:55