Character
Associated namespace: sm.character
A userdata object representing a character in the game.
Values:-
clientPublicData
[ table ]Get
: (Client-Only) The character's client public data.Set
: (Client-Only) Sets the character's client public data.
-
color
[ Color ]Get
: The character's color.Set
: (Server-Only) Sets the character's color.
-
direction
[ Vec3 ]Get
: The character's view/aim direction.
-
id
[ int ]Get
: The id of the character.
-
mass
[ number ]Get
: The mass of the character.
-
movementSpeedFraction
[ number ]Get
: The character's current movement speed fraction.Set
: (Server-Only) Sets the character's movement speed fraction.
-
publicData
[ table ]Get
: (Server-Only) The character's server public data.Set
: (Server-Only) Sets the character's server public data.
-
velocity
[ Vec3 ]Get
: The velocity of the character.
-
worldPosition
[ Vec3 ]Get
: The world position of the character.
Operation | Description |
---|---|
Character == Character | Checks if two instances of Character refer to the same Character . |
Functions
addRenderable
character:addRenderable( renderable )
Client-Only
Adds a renderable (file containing model data) to be used for the character in third person view.
Arguments:character
[ Character ]: The character.renderable
[ string ]: Path to the renderable file.
applyTumblingImpulse
character:applyTumblingImpulse( impulse )
Applies an impulse to the character's tumbling shape.
Arguments:bindAnimationCallback
character:bindAnimationCallback( animationName, triggerTime, callback )
Binds the character's animation to a callback function.
Arguments: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.
Arguments:character
[ Character ]: The character.
- [ table ]: The set of active animations.
getAnimationInfo
character:getAnimationInfo( name )
Client-Only
[Missing Description]
Arguments:character
[ Character ]: The character.name
[ string ]: The name.
- [ table ]: The animation info.
getCanSwim
character:getCanSwim()
Returns whether the character will float or sink in liquid.
Arguments:character
[ Character ]: The character.
- [ bool ]: True if the character floats, false if the character sinks.
getCharacterType
character:getCharacterType()
Returns the uuid of the character.
Arguments:character
[ Character ]: The character.
- [ Uuid ]: The character's UUID.
getClientPublicData
character:getClientPublicData()
Client-Only
Returns client public data from the character.
Arguments:character
[ Character ]: The character.
- [ table ]: The character's client public data.
getColor
character:getColor()
Returns the base color of the character.
Arguments:character
[ Character ]: The character.
- [ Color ]: The character's color.
getCurrentMovementNoiseRadius
character:getCurrentMovementNoiseRadius()
Returns the radius around the character where it can be heard.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's noise radius.
getCurrentMovementSpeed
character:getCurrentMovementSpeed()
Returns the current movement speed of the character depending on state and multiplier.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's movement speed.
getDirection
character:getDirection()
Returns the direction in which the character is viewing or aiming.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The character's view direction.
getGlowMultiplier
character:getGlowMultiplier()
Client-Only
Returns the character's glow multiplier.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's glow multiplier (0.0 - 1.0).
getHeight
character:getHeight()
Returns the height of the character.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's height.
getId
character:getId()
Returns the id of the character.
Arguments:character
[ Character ]: The character.
- [ int ]: The character's id.
getLockingInteractable
character:getLockingInteractable()
Returns the Interactable that the Character is locked to.
Arguments:character
[ Character ]: The character.
- [ Interactable ]: The interactable.
getMass
character:getMass()
Returns the mass of the character.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's mass.
getMovementSpeedFraction
character:getMovementSpeedFraction()
Returns the current fraction multiplier applied on the character's movement speed.
Arguments:character
[ Character ]: The character.
- [ number ]: The movement speed fraction.
getPlayer
character:getPlayer()
Returns the player controlling the character.
Arguments:character
[ Character ]: The character.
- [ Player ]: The character's player.
getPublicData
character:getPublicData()
Server-Only
Returns character's server public data.
Arguments:character
[ Character ]: The character.
- [ table ]: The character's server public data.
getRadius
character:getRadius()
Returns the radius of the character.
Arguments:character
[ Character ]: The character.
- [ number ]: The character's radius.
getSurfaceNormal
character:getSurfaceNormal()
Returns the normal of the character's contact with a surface.
Defaults to a zero vector when no contact is found.
character
[ Character ]: The character.
- [ Vec3 ]: The character's surface normal.
getTpBonePos
character:getTpBonePos( jointName )
Returns the world position for a bone in the third person view animation skeleton.
Arguments:character
[ Character ]: The character.jointName
[ string ]: The joint name.
- [ Vec3 ]: The joint position.
getTpBoneRot
character:getTpBoneRot( jointName )
Returns the world rotation for a bone in the third person view animation skeleton.
Arguments:character
[ Character ]: The character.jointName
[ string ]: The joint name.
- [ Quat ]: The joint rotation.
getTumblingExtent
character:getTumblingExtent()
Returns the extent of the characters tumbling shape.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The tumbling shape's extent.
getTumblingLinearVelocity
character:getTumblingLinearVelocity()
Returns the linear velocity of the characters tumbling shape.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The tumbling shape's linear velocity.
getTumblingWorldPosition
character:getTumblingWorldPosition()
Returns the world position of the characters tumbling shape.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The tumbling shape's world position.
getTumblingWorldRotation
character:getTumblingWorldRotation()
Returns the world rotation of the characters tumbling shape.
Arguments:character
[ Character ]: The character.
- [ Quat ]: The tumbling shape's world rotation.
getUnit
character:getUnit()
Returns the unit controlling the character.
Arguments:character
[ Character ]: The character.
- [ Unit ]: The unit controlling the character.
getVelocity
character:getVelocity()
Returns the velocity of the character.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The character's velocity.
getWorld
character:getWorld()
Returns the world the character exists in.
Arguments:character
[ Character ]: The character.
- [ World ]: The character's world.
getWorldPosition
character:getWorldPosition()
Returns the world position of the character.
Arguments:character
[ Character ]: The character.
- [ Vec3 ]: The character's world position.
isAiming
character:isAiming()
Returns whether the character is currently aiming with a weapon.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is aiming or not.
isClimbing
character:isClimbing()
Returns whether the character is currently climbing.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is climbing or not.
isCrouching
character:isCrouching()
Returns whether the character is currently crouching.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is crouching or not.
isDefaultColor
character:isDefaultColor()
Returns true if the character color has its default color.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character has its default color.
isDiving
character:isDiving()
Returns whether the character is currently diving.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is diving or not.
isDowned
character:isDowned()
Returns whether the character is currently downed.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is downed or not.
isOnGround
character:isOnGround()
Returns whether the character is currently standing on the ground.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is on the ground or not.
isPlayer
character:isPlayer()
Returns whether the character belongs to a player.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character belongs to a player or not.
isSprinting
character:isSprinting()
Returns whether the character is currently sprinting.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is sprinting or not.
isSwimming
character:isSwimming()
Returns whether the character is currently swimming.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is swimming or not.
isTumbling
character:isTumbling()
Returns whether the character is currently tumbling.
Arguments:character
[ Character ]: The character.
- [ bool ]: Whether the character is tumbling or not.
removeAnimationCallbacks
character:removeAnimationCallbacks()
Removes all of the character's animation callbacks.
Arguments:character
[ Character ]: The character.
removeRenderable
character:removeRenderable( renderable )
Client-Only
Removes a renderable (file containing model data) that was used for the character in third person view.
Arguments:character
[ Character ]: The character.renderable
[ string ]: Path to the renderable file.
setAllowTumbleAnimations
character:setAllowTumbleAnimations( allow )
Client-Only
Enables or disables event animations.
When set to false no animations can play while tumble is active,
when set to true the animations will play while tumbling.
character
[ Character ]: The character.allow
[ bool ]: Whether animations are allowed or not.
setClientPublicData
character:setClientPublicData( data )
Client-Only
Sets the character's client public data.
Arguments:character
[ Character ]: The character.data
[ table ]: The client public data.
setClimbing
character:setClimbing( state )
Server-Only
Sets whether the character is climbing.
Arguments:character
[ Character ]: The character.state
[ bool ]: Whether the character is climbing or not.
setColor
character:setColor( color )
Server-Only
Sets the character's color.
Arguments:setDiving
character:setDiving( state )
Server-Only
Sets whether the character is diving.
Arguments:character
[ Character ]: The character.state
[ bool ]: Whether the character is diving or not.
setDowned
character:setDowned( state )
Server-Only
Sets whether the character is downed.
Arguments:character
[ Character ]: The character.state
[ bool ]: Whether the character is downed or not.
setGlowMultiplier
character:setGlowMultiplier( value )
Client-Only
Sets a value to multiply the glow from asg texture with.
Arguments:character
[ Character ]: The character.value
[ number ]: The glow multiplier (0.0 - 1.0).
setLockingInteractable
character:setLockingInteractable( interactable )
Set the Interactable that the character is locked to.
Set it to nil
to unlock.
character
[ Character ]: The character.interactable
[ Interactable ]: The interactable.
- [ bool ]: Whether the locking/unlocking was successful.
setMovementEffects
character:setMovementEffects( filepath )
Sets the movement effect set.
Arguments:character
[ Character ]: The character.filepath
[ string ]: The effectset file path.
setMovementSpeedFraction
character:setMovementSpeedFraction( fraction )
Sets a fraction multiplier to the character's movement speed.
Arguments:character
[ Character ]: The character.fraction
[ number ]: The movement speed fraction.
setMovementWeights
character:setMovementWeights( lower, upper )
Client-Only
Sets the weights for movement animations on the character's upper and lower body.
For a value of 0 no movement animations will play, for a value of 1 the movement animations will fully play unless otherwise overridden.
Arguments:character
[ Character ]: The character.lower
[ number ]: The lower weight.upper
[ number ]: The upper weight.
setPublicData
character:setPublicData( data )
Server-Only
Sets the character's server public data.
Arguments:character
[ Character ]: The character.data
[ table ]: The server public data.
setSwimming
character:setSwimming( state )
Server-Only
Sets whether the character is swimming.
Arguments:character
[ Character ]: The character.state
[ bool ]: Whether the character is swimming or not.
setTumbling
character:setTumbling( state )
Server-Only
Sets whether the character is tumbling.
Arguments:character
[ Character ]: The character.state
[ bool ]: Whether the character is tumbling or not.
setUpDirection
character:setUpDirection( up )
Client-Only
Sets the upward direction of the character's graphics.
Arguments:updateAnimation
character:updateAnimation( name, time, weight, additive )
Client-Only
Updates the character animation.
Arguments:character
[ Character ]: The character.name
[ string ]: The animation name.time
[ number ]: The time.weight
[ number ]: The weight. Defaults to-1.0
. (Optional)additive
[ bool ]: Whether the animation will be added to the default animation. Defaults tofalse
. (Optional)
setNameTag
character:setNameTag( name, color, requiresLoS, renderDistance, fadeDistance )
Client-Only
Sets the name tag display value for the character.
Arguments:character
[ Character ]: The character.name
[ string ]: The name tag text.color
[ Color ]: The the text color. Defaults to white.requiresLoS
[ bool ]: Whether the tag requires line of sight to be visible or not. Defaults to false.renderDistance
[ number ]: The max distance the tag will be rendered in. Defaults to 10000.fadeDistance
[ number ]: The distance above which the tag starts to fade out. Defaults to 9500.
setWorldPosition
character:setWorldPosition( position )
Server-Only
Sets the world position of the character.
Arguments: