Skip to content

Player API

The Player API provides wrapped access to players currently in the instance. This includes the local player.

The local player also had a dedicated API for things specific to the local client, like Teleport and SetPosition: LocalPlayer API.

For Player related events please see Available Events - Player Events.

Player

CVR.Player

Static Members

Static Methods

Signature Description
Player[] GetAllPlayers(); Returns all players in the instance
Player[] GetRemotePlayers(); Returns only remote players in the instance

Instance Members

Instance Properties

Signature Description
string UserId { get; } Unique user identifier
string Username { get; } Display name
short NetworkId { get; } Short network identifier
GameObject GameObject { get; } Root game object representing player
AvatarPoint ViewPoint { get; } Wrapped viewpoint
AvatarPoint VoicePoint { get; } Wrapped voicepoint

Instance Methods

Signature Description
float GetInitialHeight(); Returns the player's initial height
float GetCurrentHeight(); Returns the player's current height
Vector3 GetGravity(); Returns the gravity vector
Prop[] GetSpawnedProps(); Returns props spawned by this player

AvatarPoint

CVR.AvatarPoint

Provides wrapped access to specific avatar points and their transforms. All methods retrieve transform data directly from the underlying native avatar point.

Despite avatar points being under the avatar's hierarchy, they are considered internal CVR objects by the Permission System.

Instance Members

Instance Methods

Signature Description
Transform GetPointTransform(); Returns the world-space transform for this point
Vector3 GetPointPosition(); Returns the world-space position of the point
Vector3 GetLocalPointPosition(); Returns the local-space position relative to the avatar
Vector3 GetRelativePointPosition(); Returns the relative-space position (avatar-relative with scaling applied)
Quaternion GetPointRotation(); Returns the world-space rotation
Quaternion GetLocalPointRotation(); Returns the local rotation relative to the avatar
Quaternion GetRelativePointRotation(); Returns the relative-space rotation
Vector3 GetPointForward(); Returns the world-space forward direction
Vector3 GetPointRight(); Returns the world-space right direction
Vector3 GetPointUp(); Returns the world-space up direction