Player Positions
The player's position, rotation, and velocity can be accessed and changed with Udon. All of the following nodes require VRCPlayerAPI as an input.
For nodes that deal with forces relating to Players, see Player Forces.
GetPosition
Gets the position of the Player.
Output
Vector3: The player's position in world space.
GetRotation
Gets the rotation of the Player.
Output
Quaternion: The player's rotation in world space.
GetBonePosition
Gets the position of the specified Bone in the Player's Avatar, or Vector3.Zero (0,0,0) if the bone does not exist. Note that Avatars may not have all the same bones in the places you expect, so be careful making assumptions about attributes like a player's height, pose etc based on the position of bones.
Input
HumanBodyBones: The bone to check.
Output
Vector3: The bone position in world space.
GetBoneRotation
Gets the rotation of the specified Bone in the Player's Avatar, or Quaternion.Identity (0,0,0,1) if the bone does not exist. Note that Avatars may not have all the same bones in the places you expect, so be careful making assumptions about attributes like a player's height, pose etc based on the rotation of bones.
Input
HumanBodyBones: The bone to check.
Output
Quaternion: The bone rotation in world space.
AttachTransformToBone
Attaches a transform in your world to the specified Bone in the Player's Avatar. This works by continuously updating the position and rotation of the transform without changing its parent.
If the transform was already attached to another bone on the same avatar, it will detach from the previous bone automatically. The transform stops moving for as long as the player's avatar does not have the selected bone or is a non-humanoid.
The transform is moved every frame immediately after PhysBones and Constraints have finished processing.
Do not attach a transform to bones from different players at the same time. The resulting behavior is undefined.
Inputs
Transform: The transform to attach.HumanBodyBones: The bone to attach the transform to.
DetachTransformFromBone
Detaches a transform in your world that has previously been attached to any Bone on the Player's Avatar. It will no longer have its position and rotation updated automatically to follow a bone on the avatar.
If the transform is not currently attached, calling this method does nothing.
Input
Transform: The transform to be detached.
GetTrackingData
Gets a struct called TrackingData, which contains separate Position and Rotation data. This is the suggested way to get position and rotation data for a Player's head and hands. This returns data from the TrackingManager for a Local Player (ie the data coming from their headset / trackers) and from the RightHand, LeftHand and Head bones for a Remote Player. Origin returns the center of the local VR user's playspace, while returning the player's position for local Desktop users and all remote users. AvatarRoot returns data for the root transform of the avatar (the same transform that the player capsule is attached to). For users in Fully-Body Tracking, AvatarRoot will not rotate with the head facing direction. If you need data reflecting the general forward facing direction of a Player, consider using GetRotation instead.
Input
TrackingDataType: The tracking data to check.
Output
TrackingData: The player's tracking data of the specified type.
GetVelocity
Get the speed and direction of the player's movement.
Output
Vector3 velocity: The player's velocity in world space.
SetVelocity
Set the speed and direction of the player's movement. If SetVelocity is called on the local player, their 'IsGrounded' property is set to false since they are not in direct control of their movements while this is happening.
Input
Vector3: The player's velocity in world space.
IsPlayerGrounded
Get whether the player is touching the ground, which enables Jump.
Output
bool IsPlayerGrounded: Whether the player is grounded.
TeleportTo
Send the local player to a new position and specified rotation, unless a Station does not allow it.
- Udon can only teleport the local player. Use networking to cause other players to teleport themselves.
- Stations can prevent Udon from teleporting players.
- When you teleport very often or across very short distances, consider setting
lerpOnRemotetofalse. - Teleporting a player over a distance of more than 1 meter or a rotation of more than 45 degrees will reset their animation and IK, unless
lerpOnRemoteis set to true, since this implies the teleport is being treated like normal movement.
Do not teleport players during network updates (e.g. OnDeserialization). Otherwise, their avatar may unexpectedly collide with geometry during the teleport. Instead, use SendCustomEventDelayedFrames and delay the teleport by one frame.
Inputs
Vector3 teleportPos: The target position in world space.Quaternion teleportRot: The target rotation in world space.SceneDescriptorSpawnOrientation TeleportOrientation(optional): How to align players with the destination position and rotation.bool lerpOnRemote(optional): Whether the interpolate the player's movement for remote players.- (Default) If
false, the teleportation looks instant to remote players. The network bandwidth cost increases. Avatar animation and IK are reset if the teleport distance is high enough. - If
true,the teleportation is treated like normal player movement, and movement looks smooth to remote players. Avatar animation and IK are not reset by the teleport.
- (Default) If