Character

A userdata object representing a character in the game.

Values:

  • clientPublicData [ table ]

    • Get: (Client-Only) Returns client public data from a character.
    • Set: (Client-Only) Sets client public data on a character.
  • color [ Color ]

    • Get: Returns the base color of a character.
    • Set: (Server-Only) Sets the character color.
  • direction [ Vec3 ]

    • Get: Returns the direction of where a character is viewing or aiming.
  • id [ integer ]

    • Get: Returns the id of a character.
  • mass [ number ]

    • Get: Returns the mass of a character.
  • movementSpeedFraction [ number ]

    • Get: Gets the current fraction multiplier applied on the character's movement speed.
    • Set: Sets a fraction multiplier to the character's movement speed.
  • publicData [ table ]

    • Get: (Server-Only) Returns (server) public data from a character.
    • Set: (Server-Only) Sets (server) public data on a character.
  • smoothDirection [ Vec3 ]

    • Get: Returns the smooth direction of where a character is viewing or aiming.
  • velocity [ Vec3 ]

    • Get: Returns the velocity of a character.
  • world [ World ]

    • Get: Returns the world a character exists in.
  • worldPosition [ Vec3 ]

    • Get: Returns the world position of a character.
    • Set: (Server-Only) Sets the world position of a character.

Operations:

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

Server + Client

applyTumblingImpulse

character:applyTumblingImpulse( impulse, offset )

Applies impulse to the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.
impulse Vec3 The impulse.
offset (optional) Vec3 The offset from the center point. (Defaults to no offset)

bindAnimationCallback

character:bindAnimationCallback( animationName, triggerTime, callback )

Binds a character's animation to a callback function.

Parameters:

Name Type Description
character Character The character.
animationName string The name of the animation.
triggerTime number The required time that will have elapsed in the animation when the callback is triggered.
callback string The name of the Lua function to bind.

getActiveAnimations

character:getActiveAnimations(  )

Returns the set of active animations.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
table The set of active animations { { name = string, weight = number }, ...}

getCanSwim

character:getCanSwim(  )

Returns whether the character will float or sink in liquid.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean True if the character will float, false if the character will sink.

getCharacterType

character:getCharacterType(  )

Returns the uuid of the character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Uuid The character type.

getColor

character:getColor(  )

Returns the base color of a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Color The character color.

getCurrentMovementNoiseRadius

character:getCurrentMovementNoiseRadius(  )

Returns the radius around the character where it can be heard.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The noise radius of the character.

getCurrentMovementSpeed

character:getCurrentMovementSpeed(  )

Returns the current movement speed of the character depending on state and multiplier.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The current movement speed.

getDirection

character:getDirection(  )

Returns the direction of where a character is viewing or aiming.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The character's view direction.

getHeight

character:getHeight(  )

Returns the height of a character

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The character's height.

getId

character:getId(  )

Returns the id of a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
integer The character's id.

getJumpSpeedFraction

character:getJumpSpeedFraction(  )

Gets the current fraction multiplier applied on the character's jump speed.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The jump speed fraction.

getLockingHarvestable

character:getLockingHarvestable(  )

Get the Harvestable that the Character is locked to.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Harvestable The harvestable.

getLockingInteractable

character:getLockingInteractable(  )

Get the Interactable that the Character is locked to.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Interactable The interactable.

getMass

character:getMass(  )

Returns the mass of a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The character's mass.

getMoveSpeed

character:getMoveSpeed(  )

Returns the move speed of a character

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The character's move speed.

getMovementSpeedFraction

character:getMovementSpeedFraction(  )

Gets the current fraction multiplier applied on the character's movement speed.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The movement speed fraction.

getPlayer

character:getPlayer(  )

Returns the player controlling the character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Player The player controlling the character.

getRadius

character:getRadius(  )

Returns the radius of a character

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The character's radius.

getSmoothViewDirection

character:getSmoothViewDirection(  )

Returns the smooth direction of where a character is viewing or aiming.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The character's smooth view direction.

getSprintSpeed

character:getSprintSpeed(  )

Returns the sprint speed of a character

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
number The character's sprint speed.

getSurfaceNormal

character:getSurfaceNormal(  )

Returns the normal of the character's contact with a surface. Defaults to a zero vector when no contact is found.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The surface normal.

getTpBonePos

character:getTpBonePos( jointName )

Returns the world position for a bone in the third person view animation skeleton.

Parameters:

Name Type Description
character Character The character.
jointName string The joint name.

Returns:

Type Description
Vec3 The joint position.

getTpBoneRot

character:getTpBoneRot( jointName )

Returns the world rotation for a bone in the third person view animation skeleton.

Parameters:

Name Type Description
character Character The character.
jointName string The joint name.

Returns:

Type Description
Quat The joint rotation.

getTumblingAngularVelocity

character:getTumblingAngularVelocity(  )

Returns the angular velocity of the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The tumbling shape's angular velocity.

getTumblingExtent

character:getTumblingExtent(  )

Returns the extent of the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The tumbling shape's extent.

getTumblingLinearVelocity

character:getTumblingLinearVelocity(  )

Returns the linear velocity of the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The tumbling shape's linear velocity.

getTumblingWorldPosition

character:getTumblingWorldPosition(  )

Returns the world position of the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The tumbling shape's world position.

getTumblingWorldRotation

character:getTumblingWorldRotation(  )

Returns the world rotation of the characters tumbling shape.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Quat The tumbling shape's world rotation.

getUnit

character:getUnit(  )

Returns the unit controlling the character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Unit The unit controlling the character.

getVelocity

character:getVelocity(  )

Returns the velocity of a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The character's velocity.

getWorld

character:getWorld(  )

Returns the world a character exists in.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
World The world the character exists in.

getWorldPosition

character:getWorldPosition(  )

Returns the world position of a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
Vec3 The character's world position.

isAiming

character:isAiming(  )

Returns whether a character is currently aiming with a weapon.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is aiming.

isClimbing

character:isClimbing(  )

Get the character climbing state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The climbing state.

isCrouching

character:isCrouching(  )

Returns whether a character is currently crouching.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is crouching.

isDefaultColor

character:isDefaultColor(  )

Returns true if the current character color is its default color.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean True if the color is the base color.

isDiving

character:isDiving(  )

Get the character diving state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The diving state.

isDowned

character:isDowned(  )

Get the character downed state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The downed state.

isFlying

character:isFlying(  )

Get the character flying state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The flying state.

isHovering

character:isHovering(  )

Get the character hovering state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The hovering state.

isLadderClimbing

character:isLadderClimbing(  )

Get whether the character is climbing a ladder.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The ladder climbing state.

isMoving

character:isMoving(  )

Returns whether a character is currently moving.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is moving.

isOnGround

character:isOnGround(  )

Returns whether the character is currently standing on the ground.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is on the ground.

isPlayer

character:isPlayer(  )

Returns whether a character is owned by a player.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is owned by a player.

isSeated

character:isSeated(  )

Returns whether the character is currently seated.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is seated.

isSprinting

character:isSprinting(  )

Returns whether a character is currently sprinting.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is sprinting.

isSwimming

character:isSwimming(  )

Get the character swimming state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The swimming state.

isTumbling

character:isTumbling(  )

Get the character tumbling state.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The tumbling state.

removeAnimationCallbacks

character:removeAnimationCallbacks(  )

Removes all of a character's animation callbacks.

Parameters:

Name Type Description
character Character The character.

setJumpSpeedFraction

character:setJumpSpeedFraction( fraction )

Sets a fraction multiplier to the character's jump speed.

Parameters:

Name Type Description
character Character The character.
fraction number The jump speed fraction.

setLockingHarvestable

character:setLockingHarvestable( harvestable )

Set the Harvestable that the Character is locked to. Set Harvestable to nil to unlock.

Parameters:

Name Type Description
character Character The character.
harvestable Harvestable The harvestable.

Returns:

Type Description
boolean True if the character was successfully locked or unlocked.

setLockingInteractable

character:setLockingInteractable( interactable )

Set the Interactable that the Character is locked to. Set Interactable to nil to unlock.

Parameters:

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

Returns:

Type Description
boolean True if the character was successfully locked or unlocked.

setMovementEffects

character:setMovementEffects( filepath )

Sets the movement effect set filepath.

Parameters:

Name Type Description
character Character The character.
filepath string The effect set filepath.

setMovementSpeedFraction

character:setMovementSpeedFraction( fraction )

Sets a fraction multiplier to the character's movement speed.

Parameters:

Name Type Description
character Character The character.
fraction number The movement speed fraction.

Server-only

getImmovable

character:getImmovable(  )

Returns whether a non-player character is immovable,

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean The immovable state of the character.

getPublicData

character:getPublicData(  )

Returns (server) public data from a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
table The public data.

setClimbing

character:setClimbing( state )

Sets whether the character is climbing.

Parameters:

Name Type Description
character Character The character.
state boolean The climbing state.

setColor

character:setColor( color )

Sets the character color.

Parameters:

Name Type Description
character Character The character.
color Color The character color.

setDiving

character:setDiving( state )

Sets whether the character is diving.

Parameters:

Name Type Description
character Character The character.
state boolean The diving state.

setDowned

character:setDowned( state )

Sets whether the character is downed.

Parameters:

Name Type Description
character Character The character.
state boolean The downed state.

setFlying

character:setFlying( state )

Sets whether the character is flying.

Will not activate flight for player characters.

Parameters:

Name Type Description
character Character The character.
state boolean The flying state.

setHovering

character:setHovering( state )

Sets whether the character is hovering.

Will not activate hover for player characters.

Parameters:

Name Type Description
character Character The character.
state boolean The hovering state.

setImmovable

character:setImmovable( enable )

Sets the immovable state on a non-player character. This prevents the character from updating its physics.

Parameters:

Name Type Description
character Character The character.
enable boolean Set immovable state.

setPublicData

character:setPublicData( data )

Sets (server) public data on a character.

Parameters:

Name Type Description
character Character The character.
data table The public data.

setSwimming

character:setSwimming( state )

Sets whether the character is swimming.

Note: By default the swimming state is controlled by the client as part of the player movement. This value is treated like an override that is synchronized from the server. Buoyancy calculations in the character controller require that the character touches a liquid volume.

Parameters:

Name Type Description
character Character The character.
state boolean The swimming state.

setTumbling

character:setTumbling( state )

Sets whether the character is tumbling.

Parameters:

Name Type Description
character Character The character.
state boolean The tumbling state.

setWorldPosition

character:setWorldPosition( position )

Sets the world position of a character.

Parameters:

Name Type Description
character Character The character.
position Vec3 The character's new world position.

Client-only

addRenderable

character:addRenderable( renderable )

Adds a renderable (file containing model data) to be used for the character in third person view.

Parameters:

Name Type Description
character Character The character.
renderable string The renderable path.

getAnimationInfo

character:getAnimationInfo( name )

Parameters:

Name Type Description
character Character The character.
name string The name.

Returns:

Type Description
table The animation info { name = string, duration = number, looping = boolean }.

getClientPublicData

character:getClientPublicData(  )

Returns client public data from a character.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
table The client public data.

getGlowMultiplier

character:getGlowMultiplier(  )

Gets the glow multiplier.

Parameters:

Name Type Description
character Character The character.

Returns:

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

hasActiveOverrideAnimation

character:hasActiveOverrideAnimation(  )

Returns whether or not the character has an active animation override on its third person animations.

A third person animation override could be the crowbar animation when picking something up or the hammer when placing something.

Parameters:

Name Type Description
player Character The player.

Returns:

Type Description
bool Has active animation override.

hasGraphics

character:hasGraphics(  )

Checks if a character has graphics.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character has graphics.

isVisible

character:isVisible(  )

Returns whether a character is visible.

Parameters:

Name Type Description
character Character The character.

Returns:

Type Description
boolean Whether the character is visible.

overrideRenderableList

character:overrideRenderableList( renderables )

Overrides a non player character's third person renderable list with a new list of renderables. Will trigger a rebuild of the character's graphics.

Parameters:

Name Type Description
character Character The character.
renderables table An array of renderable file paths to override with.

removeRenderable

character:removeRenderable( renderable )

Removes a renderable (file containing model data) that was used for the character in third person view.

Parameters:

Name Type Description
character Character The character.
renderable string The renderable path.

setAllowTumbleAnimations

character:setAllowTumbleAnimations( allow )

Enables or disables event animations.

When set to false no animations can play while tumble is active, and when set to true the animations will play while tumbling.

Parameters:

Name Type Description
character Character The character.
allow boolean The state.

setClientPublicData

character:setClientPublicData( data )

Sets client public data on a character.

Parameters:

Name Type Description
character Character The character.
data table The client public data.

setGlowMultiplier

character:setGlowMultiplier( value )

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

Parameters:

Name Type Description
character Character The character.
value number The glow multiplier (0.0 - 1.0).

setMovementWeights

character:setMovementWeights( lower, upper )

Sets the weights for movement animations on a character's upper and lower body.

For a value of 0 no movement animations will play, and for a value of 1 the movement animations will fully play unless otherwise overridden.

Parameters:

Name Type Description
character Character The character.
lower number The lower weight.
upper number The upper weight.

setNameTag

character:setNameTag(
    name,
    color,
    requiresLoS,
    renderDistance,
    fadeDistance
)

Sets the name tag display value for the character

Parameters:

Name Type Description
character Character The character.
name string The new name tag text value.
color (optional) Color The color of the name. (defaults to white)
requiresLoS (optional) boolean Whether broken line of sight will hide the name tag. (Defaults to false)
renderDistance (optional) number Max distance the name tag will render in. (Defaults to 10000)
fadeDistance (optional) number Distance where fade out will start. (Defaults to 9500)

setUpDirection

character:setUpDirection( up )

Sets the upward direction of the character's graphics.

Parameters:

Name Type Description
character Character The character.
up Vec3 The direction.

setVisible

character:setVisible( visible )

Sets the visibility.

Parameters:

Name Type Description
character Character The character.
visible boolean Whether the character should be visible.

updateAnimation

character:updateAnimation( name, time, weight, additive )

Updates a character animation.

Parameters:

Name Type Description
character Character The character.
name string The animation name.
time number The time.
weight (optional) number The weight. Defaults to -1.0. (Optional)
additive (optional) boolean Whether the animation will be added to the default animation. Defaults to false. (Optional)