YaCharacterAPI¶
YaCharacterAPI manages Characters in the game.
Characters are player-controlled avatars or NPCs in the scene.Functions¶
boolean YaCharacterAPI.IsPlayerCharacter(YaEntity entity)¶
ReturnsTrue if, is player character
Checks if the entity is controlled by the player.
- entityEntity
YaEntity YaCharacterAPI.GetPlayerEntity(YaEntity characterEntity)¶
ReturnsPlayer Entity
Gets the player entity.
- characterEntityCharacter entity
void YaCharacterAPI.OnPush(function callback<YaEntity, YaEntity, float3, number>)¶
SERVER ONLY 
Fired when the Character is pushed
- callbackCallback function- targetThe target Character to be pushed
- triggerThe entity that pushes the Character
- directionThe direction in which the Character is pushed
- distanceThe distance at which the Character is pushed
 
void YaCharacterAPI.OnFall(function callback<YaEntity, number>)¶
SERVER ONLY 
Fired when the Character falls
- callbackCallback function- targetThe target Character to fall
- fall heightFall height
 
void YaCharacterAPI.OnGround(function callback<YaEntity, number>)¶
SERVER ONLY 
Fired when the Character lands on the ground
- callbackCallback function- targetThe target Character landing on the ground
- fall heightFall height
 
void YaCharacterAPI.OnStartSwim(function callback<YaEntity>)¶
SERVER ONLY 
Fired when the character starts swimming
- callbackCallback function- targetThe target Character that starts swimming
 
void YaCharacterAPI.OnEndSwim(function callback<YaEntity>)¶
SERVER ONLY 
Fired when the character stops swimming
- callbackCallback function- targetThe target Character that stops swimming
 
void YaCharacterAPI.OnEnterHit(YaEntity character, function callback<YaEntity, number, float3>)¶
Character hit enter
- charactercharacter
- callbackCallback function- hitEntityHit entity
- siteThe site of contact 0:side 1:Up -1:Down
- normalThe normal direction of the contact point
 
void YaCharacterAPI.OnExitHit(YaEntity character, function callback<YaEntity>)¶
Character hit exit
- characterCharacter
- callbackCallback function- hitEntityHit entity
 
void YaCharacterAPI.OnPush(YaEntity character, function callback<YaEntity, float3, number>)¶
Current character be pushed event
- characterCharacter
- callbackCallback function- pusherThe entity that pushes the Character
- directionThe direction in which the Character is pushed
- distanceThe distance at which the Character is pushed
 
void YaCharacterAPI.OnFall(YaEntity character, function callback<number>)¶
Current character fall event
- characterCharacter
- callbackCallback function- fallHeightFall height
 
void YaCharacterAPI.OnGround(YaEntity character, function callback<number>)¶
The current character landing event
- characterCharacter
- callbackCallback function- fallHeightFall height
 
boolean YaCharacterAPI.IsCharacter(YaEntity entity)¶
ReturnsTrue if the entity is a Character
Checks if the entity is a Character.
- entityEntity
boolean YaCharacterAPI.IsDead(YaEntity entity)¶
ReturnsTrue if the Character is dead
True if the Character is dead, otherwise false.
- entityEntity
number YaCharacterAPI.GetCurrentMoveSpeed(YaEntity character)¶
ReturnsMove speed (m/s)
Get current move speed. Returns only the movement speed in the horizontal direction
- characterCharacter
number YaCharacterAPI.GetCurrentMoveDirection(YaEntity character)¶
ReturnsIn y-rotation radians
Gets the direction of the character's movement, expressed in y-rotation radians.
The direction of movement may differ from the direction of character rotation if the character is retreated
- characterCharacter
number YaCharacterAPI.GetCurrentVerticalSpeed(YaEntity character)¶
ReturnsSpeed (m/s)
Gets the speed in the current vertical
- characterCharacter
boolean YaCharacterAPI.IsGrounded(YaEntity character)¶
ReturnsIs true, character is on the ground
Whether the character is on the ground
- characterCharacter
boolean YaCharacterAPI.IsJumping(YaEntity character)¶
ReturnsIs true, character is jumping
Whether the character is jumping
- characterCharacter
boolean YaCharacterAPI.IsMoving(YaEntity character)¶
ReturnsIs true, character is moving
Whether the character is moving
- characterCharacter
boolean YaCharacterAPI.IsWalking(YaEntity character)¶
ReturnsIs true, character is walking
Whether the character is walking
- characterCharacter
boolean YaCharacterAPI.IsRunning(YaEntity character)¶
ReturnsIs true, character is running
Whether the character is running
- characterCharacter
boolean YaCharacterAPI.IsSwimming(YaEntity character)¶
ReturnsIs true, character is swimming
Whether the character is swimming
- characterCharacter
void YaCharacterAPI.SetWalkMaxSpeed(YaEntity character, number value)¶
Set the maximum walking speed
- characterCharacter
- valueMax speed (m/s)
number YaCharacterAPI.GetWalkMaxSpeed(YaEntity character)¶
ReturnsSpeed (m/s)
Gets the current walking speed
- characterCharacter
void YaCharacterAPI.SetRunMaxSpeed(YaEntity character, number value)¶
Set the maximum running speed
- characterCharacter
- valueMax speed (m/s)
number YaCharacterAPI.GetRunMaxSpeed(YaEntity character)¶
ReturnsSpeed (m/s)
Get the maximum running speed
- characterCharacter
void YaCharacterAPI.SetJumpHeight(YaEntity character, number value)¶
Set the jump height
- characterCharacter
- valueJump height
number YaCharacterAPI.GetJumpHeight(YaEntity character)¶
Returnsjump height
Gets the height of the current maximum jump
- characterCharacter
void YaCharacterAPI.SetNumberOfJump(YaEntity character, number value)¶
Set the number of consecutive jumps
- charactercharacter
- valueNumber Of Jump
number YaCharacterAPI.GetNumberOfJump(YaEntity character)¶
ReturnsNumber Of Jump
Gets the number of consecutive jumps
- charactercharacter
void YaCharacterAPI.SetGravity(YaEntity character, number value)¶
Set the Character gravity value. Affects fall speed
- characterCharacter
- valueGravity
number YaCharacterAPI.GetGravity(YaEntity character)¶
ReturnsGravity
Gets the gravity value that affects the Character
- characterCharacter
boolean YaCharacterAPI.Equip(YaEntity character, YaEntity entity, YaEquipParameter parameter)¶
ReturnsWhether the equipment was successful
Equip an Entity to Character.
- characterCharacter
- entityThe entity to be equipped
- parameterExtra parameters
boolean YaCharacterAPI.EquipTool(YaEntity character, YaEntity entity)¶
ReturnsWhether the equipment was successful
Equip a Tool Entity to Character.
- characterCharacter
- entityTool
boolean YaCharacterAPI.Unequip(YaEntity character, YaEntity entity)¶
ReturnsWhether the unequip was successful
Unload an Entity from the Character
- charactercharacter
- entityThe entity to be unequipped
YaEntity YaCharacterAPI.GetEquipByPoint(YaEntity character, number bonePoint)¶
ReturnsEquipped entity
Returns an entity somewhere on the character.
- characterCharacter
- bonePointBonePoint
YaEntity YaCharacterAPI.GetToolByHand(YaEntity character)¶
ReturnsTool entity
Gets the tool in the Character's hand.
- characterCharacter
YaEntity YaCharacterAPI.GetToolByBonePoint(YaEntity character, number point)¶
ReturnsTool entity
Gets the tool on the binding point.
- characterCharacter entity
- pointBinding bone point
Array<YaEntity> YaCharacterAPI.GetToolsByBonePoint(YaEntity character, number point)¶
ReturnsTool list
Gets all tools on the binding point.
- characterCharacter entity
- pointBinding bone point
Array<YaEntity> YaCharacterAPI.GetAllTools(YaEntity character)¶
ReturnsAll tools
Gets all tools on the Character
- characterCharacter entity