Skip to main content

Class: User

Represents a user.

Constructors​

Constructor​

new User(userId): User;

Creates a user instance.

Parameters​

ParameterTypeDescription
userIdstringThe user ID.

Returns​

User

Methods​

GetLocalUser()​

static GetLocalUser(): Promise<User>;

Gets the local user.

Returns​

Promise<User>

A promise that resolves to the local User.


GetUsers()​

static GetUsers(): Promise<User[]>;

Gets all users.

Returns​

Promise<User[]>

A promise that resolves to the list of User instances.


GetUserId()​

GetUserId(): string;

Gets the user ID.

Returns​

string

The user ID.


GetHeadEntity()​

GetHeadEntity(): Promise<number>;

Gets the head entity of the user.

Returns​

Promise<number>

A promise that resolves to the head Entity.


GetLeftHandEntity()​

GetLeftHandEntity(): Promise<number>;

Gets the left hand entity of the user.

Returns​

Promise<number>

A promise that resolves to the left hand Entity.


GetRightHandEntity()​

GetRightHandEntity(): Promise<number>;

Gets the right hand entity of the user.

Returns​

Promise<number>

A promise that resolves to the right hand Entity.


GetOriginEntity()​

GetOriginEntity(): Promise<number>;

Gets the origin entity of the user.

Returns​

Promise<number>

A promise that resolves to the origin Entity.


SetEnableLocomotion()​

SetEnableLocomotion(value): Promise<void>;

Sets whether locomotion is enabled for the user.

Parameters​

ParameterTypeDescription
valuebooleanWhether locomotion is enabled.

Returns​

Promise<void>

A promise that resolves when the locomotion setting has been changed.


GetEnableLocomotion()​

GetEnableLocomotion(): Promise<boolean>;

Gets whether locomotion is enabled for the user.

Returns​

Promise<boolean>

A promise that resolves to true if locomotion is enabled, or false otherwise.


TeleportTo()​

TeleportTo(worldPosition, worldRotation): Promise<void>;

Teleports the user to a world position and rotation.

Parameters​

ParameterTypeDescription
worldPositionvec3The destination world position.
worldRotationquatThe destination world rotation.

Returns​

Promise<void>

A promise that resolves when the user has been teleported.


GetUserWorldPosition()​

GetUserWorldPosition(): Promise<vec3>;

Gets the world position of the user.

Returns​

Promise<vec3>

A promise that resolves to the user world position.


GetUserWorldRotation()​

GetUserWorldRotation(): Promise<quat>;

Gets the world rotation of the user as a quaternion.

Returns​

Promise<quat>

A promise that resolves to the user world rotation.


IsValid()​

IsValid(): Promise<boolean>;

Checks whether the user is valid.

A referenced user may become invalid after leaving a network session.

Returns​

Promise<boolean>

A promise that resolves to true if the user is valid, or false otherwise.


IsLocal()​

IsLocal(): Promise<boolean>;

Checks whether the user is the local user.

Remote users in a network session are not local users.

Returns​

Promise<boolean>

A promise that resolves to true if the user is the local user, or false otherwise.


IsVRMode()​

IsVRMode(): Promise<boolean>;

Checks whether the user is in VR mode.

Users in PC mode return false.

Returns​

Promise<boolean>

A promise that resolves to true if the user is in VR mode, or false otherwise.


IsMenuOpen()​

IsMenuOpen(): Promise<boolean>;

Checks whether the user menu is open.

Returns​

Promise<boolean>

A promise that resolves to true if the user menu is open, or false otherwise.


IsGrounded()​

IsGrounded(): Promise<boolean>;

Checks whether the user is grounded.

Returns​

Promise<boolean>

A promise that resolves to true if the user is grounded, or false otherwise.


IsFlying()​

IsFlying(): Promise<boolean>;

Checks whether the user is flying.

Returns​

Promise<boolean>

A promise that resolves to true if the user is flying, or false otherwise.


GetMoveSpeed()​

GetMoveSpeed(): Promise<number>;

Gets the move speed of the user.

Returns​

Promise<number>

A promise that resolves to the move speed in meters per second.


SetMoveSpeed()​

SetMoveSpeed(speed): Promise<void>;

Sets the move speed of the user.

Parameters​

ParameterTypeDescription
speednumberThe move speed in meters per second.

Returns​

Promise<void>

A promise that resolves when the move speed has been changed.


GetJumpVelocity()​

GetJumpVelocity(): Promise<number>;

Gets the jump velocity of the user.

Returns​

Promise<number>

A promise that resolves to the jump velocity in meters per second.


SetJumpVelocity()​

SetJumpVelocity(velocity): Promise<void>;

Sets the jump velocity of the user.

Parameters​

ParameterTypeDescription
velocitynumberThe jump velocity in meters per second.

Returns​

Promise<void>

A promise that resolves when the jump velocity has been changed.


GetGravityStrength()​

GetGravityStrength(): Promise<number>;

Gets the gravity strength of the user.

The final gravity applied to the user is calculated by multiplying this value by the default Earth gravity.

Returns​

Promise<number>

A promise that resolves to the gravity strength.


SetGravityStrength()​

SetGravityStrength(strength): Promise<void>;

Sets the gravity strength of the user.

The final gravity applied to the user is calculated by multiplying this value by the default Earth gravity.

Parameters​

ParameterTypeDescription
strengthnumberThe gravity strength.

Returns​

Promise<void>

A promise that resolves when the gravity strength has been changed.