ParaPlayer

Implemented in com.para.services

Not creatable:You can not create a object of this class.

Description

You can use the ParaPlayer class to control the behaviors of characters in a World and get data on these characters. Each player's character is associated with a ParaPlayer object. When a player's character joins, leaves, or respawns, the OnPlayerJoined, OnPlayerLeft, or OnPlayerRespawn event will be triggered. You can listen to such events in the Lua script associated with ParaScript.

Properties

displayNameUsername of the ParaPlayer
gameObjectGameObject object associated with the ParaPlayer
isLocalDetermines whether the player is a local player.
isMasterDetermines whether the player is the master of the current room.
isRoomCreatorDetermines whether the player is the creator of the current room.
playerIDUnique ID of the ParaPlayer in the room
positionWorld position of the ParaPlayer
rotationWorld orientation of the ParaPlayer
UIDUnique user ID of the ParaPlayer
flySpeedHorizontal flight speed
flyVerticalSpeedVertical flight speed
flyMaxHeightMaximum flight height
flyMinHeightMinimum flight height
scaleThe scale of players' Avatars

Public Methods

ClearPlayerTagsClears a specified tag. All tags will be cleared if the parameter is left empty. Anyone can clear tags, with no permission required.
CrouchControls the crouch action of the player. This method is effective only for local players.
ChangeStateSwitches to a state.
ChangeVoiceChannelChanges the voice channel of the player.
DieSets a character to die.
DisableInteractionDisables interaction based on InteractiveButtonType and HandType.
DropDrops the picked-up object. This method is effective only for local players.
EnableInteractionEnables interaction based on InteractiveButtonType and HandType.
GetBonePositionReturns the position of the bone mapped by the human bone ID. Returns null if the Animator component is disabled, if no description of the Avatar exists, or if the bone ID is invalid.
GetBoneRotationReturns the orientation of the bone mapped by the human bone ID. Returns null if the Animator component is disabled, if no description of the Avatar exists, or if the bone ID is invalid.
GetBoneTransformReturns the Transform mapped by the human bone ID. Returns null if the Animator component is disabled, if no description of the Avatar exists, or if the bone ID is invalid.
GetCameraTypeReturns the camera type. This method is effective only for local players.
GetGestureReturns the player's current gesture status.
GetHeadImageReturns the player's photo information.
GetPickupInHandReturns the object picked up by a specified hand.
GetPlayerTagReturns the value of the tag specified by the player.
GetSpeedReturns the movement speed of the player.
GetStateReturns the character's state.
GetStateEnabledChecks whether the character's state is enabled.
ImmobilizeWhen this method is set to True, the player is unable to move by using the joystick. This method is effective only for local players.
You can undo this effect by setting this method to False. This setting does not affect the player's current state and only applies to subsequent input.
InteractUsed for interaction with other objects by the player. This method is effective only for local players.
IsDeadChecks whether the player is dead.
IsOnlineChecks whether the player is online.
IsSittingChecks whether the player is sitting.
IsPlayerGroundedChecks whether the player is on the ground.
JumpJumps.
MoveContinuouslyControls the player's movement toward a certain direction.
PickupPicks up the specified object. This method is effective only for local players.
PlayAnimationPlays an action. You can use an Animation Event and pass a callback function.
SetAlphaSets the semi-transparency value for the player. When it is set to a value less than 1.0, the player is no longer affected by the transparency change from the camera's zoom-in. when it is set to 1.0, the player returns to normal status.
SetCameraTypeSets the perspective (the first-person perspective or third-person perspective). This method is only effective for local players.
SetJumpHeightSets the jump height.
GetJumpHeightGets the jump height.
SetPlayerTagAdds a tag to the player. Anyone can add a tag, with no permission required.
SetOverrideAnimationControllerSets the Animator Override Controller.
SetOverrideAnimationSets the animation for overriding. If the value is nil, the original animation will be restored. You can use an Animation Event and pass a callback function.
SetSpeedSets the speed. This method is effective only for local players.
SetStateEnabledEnables/Disables the character's state.
SitDownSits down. This method is effective only for local players.
StandUpStands up. This method is effective only for local players.
StopAnimationStops playing actions.
StopMovingStops the player from moving and cancels the effect of MoveContinuously.
SetParaCameraOffsetSets the offset of the official camera's focus relative to the viewpoint. This method is effective only for local players.
TeleportTeleports the player. This method is effective only for local players.
TryOnAvatarTries on a character.
GetVoiceVolumeGets the volume of the microphone that is currently used by the character.
SetIKEnableSets whether to enable IK Layer for a player. This may affect hand-waving, head movement along with the camera, and other effects.
ShowNameplateShows or hides the nameplate of a character.
SetAvatarColliderSets the dimensions of a character to modify the volume of the character's capsule collider.
GetNameplateGets the nameplate.
EnableAvatarFadeSets whether to enable the semi-transparency effect for overlapping Avatars.
SetGravityScaleSets the ratio of the player's gravity to the global gravity.
GetGravityScaleGets the ratio of the player's gravity to the global gravity.
SetVelocitySets the instantaneous velocity of the player.
GetVelocityGets the instantaneous velocity of the player.
SetCrouchSpeedSets the crouch speed.
GetCrouchSpeedGets the crouch speed.
StartFlyStarts flying
NetSpawnCreates a network object bound with the character.

Messages

OnStateChangedCallback triggered when the state of the character is changed. The first AvatarStateType parameter indicates the old state and the second AvatarStateType parameter indicates the new state.
OnStateEnabledChangedCallback triggered when the enabled state is changed
OnDiedCallback triggered when the character dies
OnAvatarLoadedCallback triggered for responding when the player's Avatar resources are fully loaded