PlayerWrapper class
Represents a player entity in the game.
A PlayerWrapper instance is always created for the main player of the game; In mulitplayer mode, a PlayerWrapper instanceRor remote players in mulitplayer mode.
By default an avatar component is created for each player. You can customise the avatar used by the game using the current snippet in the onPreload
method of the script
Signature:
export declare class PlayerWrapper
Remarks
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the PlayerWrapper
class.
Properties
Property |
Modifiers |
Type |
Description |
---|---|---|---|
Avatar component attached to the player | |||
any |
Current avatar data for the player, this is the data used to create the avatar component | ||
Promise<AvatarComponent> |
A promise that resolves when the avatar component for the player is created | ||
Current data for the player (session id, name, position, rotation etc) | |||
{ userDataChange: string; userChanged: string; } | |||
|
boolean |
Returns true if the player is anonymous (not logged in) | |
|
boolean |
Returns true if the player is the host of the game, in multiplayer mode the host is the player who created the game room | |
|
string |
Returns the player's name | |
|
string |
Returns the player's session id, in multiplayer this is the id assigned by the server | |
|
string |
Returns the player's user id |
Methods
Method |
Modifiers |
Description |
---|---|---|
Returns the default avatar data used to create the avatar component | ||
Set the avatar data used to create the avatar component for the player | ||
Set the others data used to create the avatar component for the player |