Interactable

Associated namespace: sm.interactable

A userdata object representing an interactable shape in the game.

Values:

Functions:

Operations:

OperationDescription
Interactable == InteractableChecks if two instances of Interactable refer to the same Interactable.

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.


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:

Returns the Shape of an interactable.


type string

Get:

Returns the interactable type of an interactable.


addContainer(interactable, index, size, stackSize=MaxSize)

Server only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index of the container [0-15].
integersizeThe number of slots in the container.
integerstackSize=MaxSizeThe stack size. Defaults to maximum possible stack size(65535).

Returns:

TypeDescription
ContainerThe created container.

connect(parent, child)

Server only

Connects two interactables. Similar to using the Connect Tool.

Parameters:

TypeNameDescription
InteractableparentThe sender of a connection.
InteractablechildThe receiver of a connection.

Returns:

TypeDescription
booleanReturns true if the connection attempt was successful.

connectToJoint(parent, child)

Server only

Connects interactable with joint.

Parameters:

TypeNameDescription
InteractableparentThe sender of a connection.
JointchildThe receiver of a connection.

disconnect(parent, child)

Server only

Disconnects two interactables. Similar to using the Connect Tool.

Parameters:

TypeNameDescription
InteractableparentThe sender of a connection.
InteractablechildThe receiver of a connection.

Returns:

TypeDescription
booleanReturns true if the disconnect attempt was successful.

getAnimDuration(interactable, name)

Client only

Returns animation duration in seconds.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe name of the animation.

Returns:

TypeDescription
numberThe animation duration.

getBearings(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
tableA table of the connected bearings {Joint, ..}.

getBody(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
BodyThe body an interactable's shape is part of.

getChildren(interactable, flags)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerflagsConnection type flags filter. (defaults to all types except for sm.interactable.connectionType.bearing (for backwards compability))

Returns:

TypeDescription
tableA table of the connected child interactables {Interactable, ..}.

getColorHighlight(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
ColorThe connection-point highlight color.

getColorNormal(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
ColorThe connection-point color.

getConnectionInputType(interactable)

Returns the input connection type.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerconnection type The input connection type.

getConnectionOutputType(interactable)

Returns the output connection type.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerconnection type The output connection type.

getContainer(interactable, index=0)

Returns the container stored in the given index inside the controller

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindex=0The index of the container (default: 0).

Returns:

TypeDescription
ContainerThe container.

getGlowMultiplier(interactable)

Client only

Gets the glow multiplier.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
numberThe glow multiplier (0.0 - 1.0).

getId(interactable)

Returns the id of an interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerThe interactable's id.

getJoints(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
tableA table of the connected joints {Joint, ..}.

getLocalBonePosition(interactable, name)

Return the position of the bone

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe bone name.

Returns:

TypeDescription
Vec3The position.

getMaxChildCount(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerThe max child connection count.

getMaxParentCount(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerThe max parent connection count.

getParents(interactable, flags)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerflagsConnection type flags filter. (default to all types)

Returns:

TypeDescription
tableA table of the connected parent interactables {Interactable, ..}.

getPistons(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
tableA table of the connected pistons {Joint, ..}.

getPoseWeight(interactable, index)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index.

Returns:

TypeDescription
numberThe pose weight.

getPower(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
numberThe power output signal.

getPublicData(interactable)

Server only

Returns (server) public data from a interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
tableThe public data.

getSeatCharacter(interactable)

Returns the Character that is seated in the Interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
CharacterThe character.

getSeatInteractables(interactable)

Retrieves the list of Interactable connected to the seat.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
tableThe list of connected interactables {Interactable, ..}.

getShape(interactable)

Returns the Shape of an interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
ShapeThe shape which hosts the interactable.

getSingleParent(interactable)

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:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
InteractableThe connected parent interactable.

getSteeringAngle(interactable)

Returns the steering angle of an steering interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
numberThe steering angle

getSteeringJointLeftAngleLimit(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
numberThe left angle limit.

getSteeringJointLeftAngleSpeed(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
numberThe left angle speed.

getSteeringJointRightAngleLimit(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
numberThe right angle limit.

getSteeringJointRightAngleSpeed(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
numberThe right angle speed.

getSteeringJointSettings(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
number,number,number,number,booleanThe left angle speed; right angle speed; left angle limit; right angle limit; true if the joint is unlocked.

getSteeringJointUnlocked(interactable, joint)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.

Returns:

TypeDescription
booleanTrue if the joint is unlocked

getSteeringPower(interactable)

Returns the Character that is locking the controller.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
CharacterThe character.

getType(interactable)

Returns the interactable type of an interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
stringThe interactable's type. (sm.interactable.types)

getUvFrameIndex(interactable)

Client only

Returns the index of the current UV animation frame

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
integerThe uv frame.

getWorldBonePosition(interactable, name)

Return the position of the bone

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe bone name.

Returns:

TypeDescription
Vec3The position.

hasAnim(interactable, name)

Client only

Checks if an animation exists.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe name of the animation.

Returns:

TypeDescription
booleanTrue if exists, false otherwise.

hasOutputType(interactable, flags)

Returns true if the Interactable has the output type.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerflagsThe output type.

Returns:

TypeDescription
booleanHas the output type.

hasSeat(interactable)

Returns true if Interactable has a seat component.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
booleanThe result.

hasSteering(interactable)

Returns true if Interactable has a steering component.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
booleanThe result.

isActive(interactable)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.

Returns:

TypeDescription
booleanThe logic output signal.

pressSeatInteractable(interactable, index)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index of the interactable to press.

Returns:

TypeDescription
booleanTrue if successful.

releaseSeatInteractable(interactable, index)

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index of the interactable to release.

Returns:

TypeDescription
booleanTrue if successful.

removeContainer(interactable, index)

Server only

Removes the container stored in the given index inside the controller

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index of the container.

setActive(interactable, signal)

Server only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
booleansignalThe logic output signal.

setAnimEnabled(interactable, name, enabled)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe name of the animation.
booleanenabledThe boolean enable state.

setAnimProgress(interactable, name, progress)

Client only

Sets the progress on the animation with the given name.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameThe name of the animation.
numberprogressThe animation's progress between 0 and 1.

setGlowMultiplier(interactable, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
numbervalueThe glow multiplier (0.0 - 1.0).

setGyroDirection(interactable, direction)

Client only

Set the direction of the gyro

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
Vec3directionThe gyro direction.

setParams(interactable, data)

Sets param data for a script interactable

Parameters:

TypeNameDescription
InteractableinteractableThe interactable, needs to be of script type.
anydataThe param data.

setPoseWeight(interactable, index, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index.
numbervalueThe pose weight.

setPower(interactable, signal)

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.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
numbersignalThe power output signal.

setPublicData(interactable, data)

Server only

Sets (server) public data on a interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
tabledataThe public data.

setSeatCharacter(interactable, character)

Requests to seat a Character in the Interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
CharactercharacterThe character.

setSteeringFlag(interactable, steering)

Set the steering flag for a steering interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integersteeringflags The steering flags.

setSteeringJointLeftAngleLimit(interactable, joint, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
numbervalueThe left angle limit.

setSteeringJointLeftAngleSpeed(interactable, joint, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
numbervalueThe left angle speed.

setSteeringJointRightAngleLimit(interactable, joint, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
numbervalueThe right angle limit.

setSteeringJointRightAngleSpeed(interactable, joint, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
numbervalueThe right angle speed.

setSteeringJointSettings(interactable, joint, left, right, left, right, unlocked)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
numberleftangle speed The left angle speed.
numberrightangle speed The right angle speed.
numberleftangle limit The left angle limit.
numberrightangle limit The right angle limit.
booleanunlockedReturns true if the joint is unlocked.

setSteeringJointUnlocked(interactable, joint, value)

Client only

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

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
JointjointThe joint.
booleanvaluetrue if joint is unlocked

setSubMeshVisible(interactable, name, visible)

Client only

Set the visibility of a submesh

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
stringnameName of the submesh.
booleanvisibleTrue if the submesh should be visible.

setUvFrameIndex(interactable, index)

Client only

Sets the UV animation frame with the given index.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integerindexThe index.

unsetSteeringFlag(interactable, steering)

Unset the steering flag for a steering interactable.

Parameters:

TypeNameDescription
InteractableinteractableThe interactable.
integersteeringflags The steering flags.