Interactable

Represents an interactable object in the game

Values:

  • active [ boolean ]

    • Get: Returns the logic output signal of an interactable. Signal is a boolean, on or off.
    • Set: (Server-Only) Sets the logic output signal of an interactable. Signal is a boolean, on or off.
  • body [ Body ]

    • Get: Returns the Body an interactable's Shape is part of.
  • clientPublicData [ table ]

    • Get: (Client-Only) Returns (client) public data from a interactable.
    • Set: (Client-Only) Sets (client) public data on a interactable.
  • id [ integer ]

    • Get: Returns the id of an interactable.
  • power [ number ]

    • Get: Returns the power output signal of an interactable. Signal is a number between -1 to 1, where 1 is forward and -1 backward.
    • Set: (Server-Only) Sets the power output signal of an interactable. Signal is a number between -1 to 1, where 1 is forward and -1 backward.
  • publicData [ table ]

    • Get: (Server-Only) Returns (server) public data from a interactable.
    • Set: (Server-Only) Sets (server) public data on a interactable.
  • shape [ Shape ]

    • Get: The shape which hosts the interactable.
  • type [ string ]

Operations:

Operation Returns Description
Interactable == Interactable boolean Checks if two instances of Interactable refer to the same Interactable.

Server + Client

getBearings

interactable:getBearings(  )

Returns a table of bearings that an interactable is connected to.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table A table of the connected bearings {Joint, ..}.

getBody

interactable:getBody(  )

Returns the Body an interactable's Shape is part of.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Body The body an interactable's shape is part of.

getChildren

interactable:getChildren( flags )

Returns a table of child interactables that an interactable is connected to. The children listen to the interactable's output.

Parameters:

Name Type Description
interactable Interactable The interactable.
flags integer Connection type flags filter. (defaults to all types except for sm.interactable.connectionType.bearing and sm.interactable.connectionType.steering (for backwards compability))

Returns:

Type Description
table A table of the connected child interactables {Interactable, ..}.

getColorHighlight

interactable:getColorHighlight(  )

Returns the connection-point highlight color of an interactable. The point is shown when using the Connect Tool.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Color The connection-point highlight color.

getColorNormal

interactable:getColorNormal(  )

Returns the connection-point color of an interactable. The point is shown when using the Connect Tool.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Color The connection-point color.

getConnectionInputType

interactable:getConnectionInputType(  )

Returns the input connection type.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer connection type The input connection type.

getConnectionOutputType

interactable:getConnectionOutputType(  )

Returns the output connection type.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer connection type The output connection type.

getContainer

interactable:getContainer( index )

Returns the container stored in the given index inside the controller

Parameters:

Name Type Description
interactable Interactable The interactable.
index (optional) integer The index of the container (default: 0).

Returns:

Type Description
Container The container.

getId

interactable:getId(  )

Returns the id of an interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer The interactable's id.

getJointCustomData

interactable:getJointCustomData( joint )

Returns custom joint script data.

Parameters:

Name Type Description
interactable Interactable The interactable, needs to be of script type.
joint Joint The joint.

Returns:

Type Description
any The data.

getJoints

interactable:getJoints(  )

Returns a table of all joints that an interactable is connected to. Joints include bearings and pistons.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table A table of the connected joints {Joint, ..}.

getLocalBonePosition

interactable:getLocalBonePosition( name )

Return the position of the bone

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The bone name.

Returns:

Type Description
Vec3 The position.

getMaxChildCount

interactable:getMaxChildCount(  )

Returns the maximum number of allowed child connections of an interactable – the number of outgoing connections.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer The max child connection count.

getMaxParentCount

interactable:getMaxParentCount(  )

Returns the maximum number of allowed parent connections of an interactable – the number of incoming connections.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer The max parent connection count.

getParents

interactable:getParents( flags )

Returns a table of parent interactables that are connected to an interactable. The parents act as the interactable's input.

Parameters:

Name Type Description
interactable Interactable The interactable.
flags integer Connection type flags filter. (default to all types)

Returns:

Type Description
table A table of the connected parent interactables {Interactable, ..}.

getPistons

interactable:getPistons(  )

Returns a table of pistons that an interactable is connected to.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table A table of the connected pistons {Joint, ..}.

getPower

interactable:getPower(  )

Returns the power output signal of an interactable. Signal is a number between -1 to 1, where 1 is forward and -1 backward.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
number The power output signal.

getSeatCharacter

interactable:getSeatCharacter(  )

Returns the Character that is seated in the Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Character The character.

getSeatInteractables

interactable:getSeatInteractables(  )

Retrieves the list of Interactable connected to the seat.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table The list of connected interactables {Interactable, ..}.

getShape

interactable:getShape(  )

Returns the Shape of an interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Shape The shape which hosts the interactable.

getSingleParent

interactable:getSingleParent(  )

Returns the parent Interactable that is connected to an interactable. The parent act as the interactable's input.

Warning: This method is not allowed for an interactable that allows more than one parent connection.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Interactable The connected parent interactable.

getSteeringAngle

interactable:getSteeringAngle(  )

Returns the steering angle of an steering interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
number The steering angle

getSteeringJointLeftAngleLimit

interactable:getSteeringJointLeftAngleLimit( joint )

Returns the left angle limit of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
number The left angle limit.

getSteeringJointLeftAngleSpeed

interactable:getSteeringJointLeftAngleSpeed( joint )

Returns the left angle speed of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
number The left angle speed.

getSteeringJointRightAngleLimit

interactable:getSteeringJointRightAngleLimit( joint )

Returns the right angle limit of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
number The right angle limit.

getSteeringJointRightAngleSpeed

interactable:getSteeringJointRightAngleSpeed( joint )

Returns the right angle speed of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
number The right angle speed.

getSteeringJointSettings

interactable:getSteeringJointSettings( joint )

Returns the settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
number The left angle speed
number right angle speed
number left angle limit
number right angle limit
boolean true if the joint is unlocked.

getSteeringJointUnlocked

interactable:getSteeringJointUnlocked( joint )

Returns the unlocked state of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.

Returns:

Type Description
boolean True if the joint is unlocked

getSteeringPower

interactable:getSteeringPower(  )

Returns the Character that is locking the controller.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
Character The character.

getSteeringSprint

interactable:getSteeringSprint(  )

Returns the sprint value of an steering interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
boolean The sprint value

getType

interactable:getType(  )

Returns the interactable type of an interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
string The interactable's type. (sm.interactable.types)

getWorldBonePosition

interactable:getWorldBonePosition( name )

Return the position of the bone

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The bone name.

Returns:

Type Description
Vec3 The position.

hasChanged

interactable:hasChanged( tick )

Returns true if the interactable had updates since the given tick.

Parameters:

Name Type Description
interactable Interactable The interactable.
tick integer The tick.

Returns:

Type Description
boolean Returns true if the interactable has been updated.

hasOutputType

interactable:hasOutputType( flags )

Returns true if the Interactable has the output type.

Parameters:

Name Type Description
interactable Interactable The interactable.
flags integer The output type.

Returns:

Type Description
boolean Has the output type.

hasSeat

interactable:hasSeat(  )

Returns true if Interactable has a seat component.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
boolean The result.

hasSteering

interactable:hasSteering(  )

Returns true if Interactable has a steering component.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
boolean The result.

isActive

interactable:isActive(  )

Returns the logic output signal of an interactable. Signal is a boolean, on or off.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
boolean The logic output signal.

pressSeatInteractable

interactable:pressSeatInteractable( index )

Triggers a press interaction on a Interactable connected to the seat.

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index of the interactable to press.

Returns:

Type Description
boolean True if successful.

releaseSeatInteractable

interactable:releaseSeatInteractable( index )

Triggers a release interaction on a Interactable connected to the seat.

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index of the interactable to release.

Returns:

Type Description
boolean True if successful.

setGyroForce

interactable:setGyroForce( force )

Sets a max motor force on the turret seat

Parameters:

Name Type Description
force number The maximum motor force.

setGyroMaxSpeed

interactable:setGyroMaxSpeed( speedModifier )

Sets a target speed multiplier on the turret seat

Parameters:

Name Type Description
speedModifier number The speed modifier.

setParams

interactable:setParams( data )

Sets param data for a script interactable

Parameters:

Name Type Description
interactable Interactable The interactable, needs to be of script type.
data any The param data.

setSeatCharacter

interactable:setSeatCharacter( character )

Requests to seat a Character in the Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
character Character The character.

setSteeringFlag

interactable:setSteeringFlag( steeringFlags )

Set the steering flag for a steering interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
steeringFlags integer The steering flags.

unsetSteeringFlag

interactable:unsetSteeringFlag( steeringFlags )

Unset the steering flag for a steering interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
steeringFlags integer The steering flags.

Server-only

addContainer

interactable:addContainer( index, size, stackSize )

Creates and stores a container in the given index inside the controller

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index of the container [0-15].
size integer The number of slots in the container.
stackSize (optional) integer The stack size. Defaults to maximum possible stack size(65535).

Returns:

Type Description
Container The created container.

bindDamageDestruction

interactable:bindDamageDestruction( callback )

Binds a callback to be called if the interactable is destroyed through a source of damage.

Parameters:

Name Type Description
interactable Interactable The interactable.
callback string The name of the lua function to bind.

clearLightOverrideColor

interactable:clearLightOverrideColor(  )

Clear the override color of a light controller.

Parameters:

Name Type Description
interactable Interactable The interactable.

connect

interactable:connect( child )

Connects two interactables. Similar to using the Connect Tool.

Parameters:

Name Type Description
parent Interactable The sender of a connection.
child Interactable The receiver of a connection.

Returns:

Type Description
boolean Returns true if the connection attempt was successful.

connectToJoint

interactable:connectToJoint( child )

Connects interactable with joint.

Parameters:

Name Type Description
parent Interactable The sender of a connection.
child Joint The receiver of a connection.

disconnect

interactable:disconnect( child )

Disconnects two interactables. Similar to using the Connect Tool.

Parameters:

Name Type Description
parent Interactable The sender of a connection.
child Interactable The receiver of a connection.

Returns:

Type Description
boolean Returns true if the disconnect attempt was successful.

getCarryData

interactable:getCarryData(  )

Get carry data for a script interactable

Parameters:

Name Type Description
interactable Interactable The interactable, needs to be of script type.

Returns:

Type Description
any The data

getPublicData

interactable:getPublicData(  )

Returns (server) public data from a interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table The public data.

removeContainer

interactable:removeContainer( index )

Removes the container stored in the given index inside the controller

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index of the container.

setActive

interactable:setActive( signal )

Sets the logic output signal of an interactable. Signal is a boolean, on or off.

Parameters:

Name Type Description
interactable Interactable The interactable.
signal boolean The logic output signal.

setCarryData

interactable:setCarryData( data )

Set carry data for a script interactable

Parameters:

Name Type Description
interactable Interactable The interactable, needs to be of script type.
data any The carry data.

setJointCustomData

interactable:setJointCustomData( joint, data )

Sets custom joint script data.

Parameters:

Name Type Description
interactable Interactable The interactable, needs to be of script type.
joint Joint The joint.
data any The data.

setLightOverrideColor

interactable:setLightOverrideColor( color )

Set the override color of a light controller, ignoring the color of the shape.

Parameters:

Name Type Description
interactable Interactable The interactable.
color Color The color to override with.

setPower

interactable:setPower( signal )

Sets the power output signal of an interactable. Signal is a number between -1 to 1, where 1 is forward and -1 backward.

Parameters:

Name Type Description
interactable Interactable The interactable.
signal number The power output signal.

setPublicData

interactable:setPublicData( data )

Sets (server) public data on a interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
data table The public data.

Client-only

getAnimDuration

interactable:getAnimDuration( name )

Returns animation duration in seconds.

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The name of the animation.

Returns:

Type Description
number The animation duration.

getClientPublicData

interactable:getClientPublicData(  )

Returns (client) public data from a interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
table The public data.

getGlowMultiplier

interactable:getGlowMultiplier(  )

Gets the glow multiplier.

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
number The glow multiplier (0.0 - 1.0).

getPoseWeight

interactable:getPoseWeight( index )

Returns the pose weight of the pose in the given index.

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index.

Returns:

Type Description
number The pose weight.

getUvFrameIndex

interactable:getUvFrameIndex(  )

Returns the index of the current UV animation frame

Parameters:

Name Type Description
interactable Interactable The interactable.

Returns:

Type Description
integer The uv frame.

hasAnim

interactable:hasAnim( name )

Checks if an animation exists.

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The name of the animation.

Returns:

Type Description
boolean True if exists, false otherwise.

isAnimLooping

interactable:isAnimLooping( name )

Returns if the animation isLooping or not.

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The name of the animation.

Returns:

Type Description
bool Is the animation looping.

setAnimEnabled

interactable:setAnimEnabled( name, enabled )

Sets whether the animation with the given name should be applied to the mesh. True enables the animation and false disables it.

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The name of the animation.
enabled boolean The boolean enable state.

setAnimProgress

interactable:setAnimProgress( name, progress )

Sets the progress on the animation with the given name.

Parameters:

Name Type Description
interactable Interactable The interactable.
name string The name of the animation.
progress number The animation's progress between 0 and 1.

setClientPublicData

interactable:setClientPublicData( data )

Sets (client) public data on a interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
data table The public data.

setGlowMultiplier

interactable:setGlowMultiplier( value )

Sets a value to multiply the glow from asg texture with.

Parameters:

Name Type Description
interactable Interactable The interactable.
value number The glow multiplier (0.0 - 1.0).

setGyroDirection

interactable:setGyroDirection( direction )

Set the direction of the gyro

Parameters:

Name Type Description
interactable Interactable The interactable.
direction Vec3 The gyro direction.

setPoseWeight

interactable:setPoseWeight( index, value )

Set the pose weight of the pose in the given index.

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index.
value number The pose weight.

setSteeringJointLeftAngleLimit

interactable:setSteeringJointLeftAngleLimit( joint, value )

Sets the left angle limit settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
value number The left angle limit.

setSteeringJointLeftAngleSpeed

interactable:setSteeringJointLeftAngleSpeed( joint, value )

Sets the left angle speed settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
value number The left angle speed.

setSteeringJointRightAngleLimit

interactable:setSteeringJointRightAngleLimit( joint, value )

Sets the right angle limit settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
value number The right angle limit.

setSteeringJointRightAngleSpeed

interactable:setSteeringJointRightAngleSpeed( joint, value )

Sets the right angle speed settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
value number The right angle speed.

setSteeringJointSettings

interactable:setSteeringJointSettings(
    joint,
    leftAngleSpeed,
    rightAngleSpeed,
    leftAngleLimit,
    rightAngleLimit,
    unlocked
)

Sets the settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
leftAngleSpeed number The left angle speed.
rightAngleSpeed number The right angle speed.
leftAngleLimit number The left angle limit.
rightAngleLimit number The right angle limit.
unlocked boolean Whether the joint is unlocked.

setSteeringJointUnlocked

interactable:setSteeringJointUnlocked( joint, value )

Sets unlocked settings of a Joint connected to a steering Interactable.

Parameters:

Name Type Description
interactable Interactable The interactable.
joint Joint The joint.
value boolean true if joint is unlocked

setSubMeshVisible

interactable:setSubMeshVisible( name, visible )

Set the visibility of a submesh

Parameters:

Name Type Description
interactable Interactable The interactable.
name string Name of the submesh.
visible boolean True if the submesh should be visible.

setUvFrameIndex

interactable:setUvFrameIndex( index )

Sets the UV animation frame with the given index.

Parameters:

Name Type Description
interactable Interactable The interactable.
index integer The index.