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 functiontargetThe target Character to be pushedtriggerThe entity that pushes the CharacterdirectionThe direction in which the Character is pusheddistanceThe distance at which the Character is pushed
void YaCharacterAPI.OnFall(function callback<YaEntity, number>)¶
SERVER ONLY
Fired when the Character falls
callbackCallback functiontargetThe target Character to fallfall heightFall height
void YaCharacterAPI.OnGround(function callback<YaEntity, number>)¶
SERVER ONLY
Fired when the Character lands on the ground
callbackCallback functiontargetThe target Character landing on the groundfall heightFall height
void YaCharacterAPI.OnStartSwim(function callback<YaEntity>)¶
SERVER ONLY
Fired when the character starts swimming
callbackCallback functiontargetThe target Character that starts swimming
void YaCharacterAPI.OnEndSwim(function callback<YaEntity>)¶
SERVER ONLY
Fired when the character stops swimming
callbackCallback functiontargetThe target Character that stops swimming
void YaCharacterAPI.OnEnterHit(YaEntity character, function callback<YaEntity, number, float3>)¶
Character hit enter
charactercharactercallbackCallback functionhitEntityHit entitysiteThe site of contact 0:side 1:Up -1:DownnormalThe normal direction of the contact point
void YaCharacterAPI.OnExitHit(YaEntity character, function callback<YaEntity>)¶
Character hit exit
characterCharactercallbackCallback functionhitEntityHit entity
void YaCharacterAPI.OnPush(YaEntity character, function callback<YaEntity, float3, number>)¶
Current character be pushed event
characterCharactercallbackCallback functionpusherThe entity that pushes the CharacterdirectionThe direction in which the Character is pusheddistanceThe distance at which the Character is pushed
void YaCharacterAPI.OnFall(YaEntity character, function callback<number>)¶
Current character fall event
characterCharactercallbackCallback functionfallHeightFall height
void YaCharacterAPI.OnGround(YaEntity character, function callback<number>)¶
The current character landing event
characterCharactercallbackCallback functionfallHeightFall 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
characterCharactervalueMax 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
characterCharactervalueMax 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
characterCharactervalueJump 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
charactercharactervalueNumber 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
characterCharactervalueGravity
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.
characterCharacterentityThe entity to be equippedparameterExtra parameters
boolean YaCharacterAPI.EquipTool(YaEntity character, YaEntity entity)¶
ReturnsWhether the equipment was successful
Equip a Tool Entity to Character.
characterCharacterentityTool
boolean YaCharacterAPI.Unequip(YaEntity character, YaEntity entity)¶
ReturnsWhether the unequip was successful
Unload an Entity from the Character
charactercharacterentityThe entity to be unequipped
YaEntity YaCharacterAPI.GetEquipByPoint(YaEntity character, number bonePoint)¶
ReturnsEquipped entity
Returns an entity somewhere on the character.
characterCharacterbonePointBonePoint
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 entitypointBinding bone point
Array<YaEntity> YaCharacterAPI.GetToolsByBonePoint(YaEntity character, number point)¶
ReturnsTool list
Gets all tools on the binding point.
characterCharacter entitypointBinding bone point
Array<YaEntity> YaCharacterAPI.GetAllTools(YaEntity character)¶
ReturnsAll tools
Gets all tools on the Character
characterCharacter entity