Player
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public static class PlayerNamespace NodeWorld.Flux.
The local player, as a script sees it: its pose, its avatar's bones, and what a world may do to it (teleport, walking speeds, gravity, velocity, haptics). Avatars are not accessible to scripts.
Properties
position
public static Vector3 position { get; }Position of the local player in the world.
rotation
public static Quaternion rotation { get; }Rotation of the local player in the world.
headPosition
public static Vector3 headPosition { get; }The head (camera) of the local player.
headRotation
public static Quaternion headRotation { get; }Rotation of the local player's head (the camera).
isInVR
public static bool isInVR { get; }The local player plays in a VR headset.
id
public static int id { get; }Id of the local player in the room (0 on the server).
name
public static string name { get; }The display name of the local player.
accountId
public static string accountId { get; }The NodeWorld account of the local player: the same in every room and every visit.
language
public static string language { get; }The language of the player's client ("fr", "en"...); OnLanguageChanged tells a change.
isMaster
public static bool isMaster { get; }The local player is the master of the room.
isGrounded
public static bool isGrounded { get; }The local player stands on the ground.
velocity
public static Vector3 velocity { get; set; }The velocity of the local player; setting it moves the player (gravity and the ground then act on it).
walkSpeed
public static float walkSpeed { get; set; }Walking speed of the local player.
runSpeed
public static float runSpeed { get; set; }Running speed of the local player.
strafeSpeed
public static float strafeSpeed { get; set; }Sideways speed of the local player.
jumpImpulse
public static float jumpImpulse { get; set; }Vertical speed of a jump (m/s); 0: no jump.
gravityStrength
public static float gravityStrength { get; set; }Multiplier of the gravity on the local player (1: normal, 0: none).
immobilized
public static bool immobilized { get; set; }The player cannot walk (its input is ignored); the world may still move it.
sittingPoint
public static Transform sittingPoint { get; set; }The local avatar sits on this point in its sitting pose (thighs forward, knees bent, feet on the ground under its knees): its root (the ground under its hips) on the point, facing its forward, tilted with it, following it when it moves. Its hips stay there; its head and hands still follow the player. null: it stands again. The world places the player itself (Teleport): its eyes at sittingEyeOffset from the point.
sittingEyeOffset
public static Vector3 sittingEyeOffset { get; }Where the eyes of the local avatar are in its sitting pose, from the point it sits on, in that point's space (x right, y up, z forward, m); zero without an avatar.
Methods
GetTrackingPosition
public static Vector3 GetTrackingPosition(TrackingPoint point)Position of a tracked point of the local player: its head, a hand, or the origin of its play space.
GetTrackingRotation
public static Quaternion GetTrackingRotation(TrackingPoint point)Rotation of a tracked point of the local player: its head, a hand, or the origin of its play space.
GetBonePosition
public static Vector3 GetBonePosition(Bone bone)A bone of the local avatar (world space); Vector3.zero without an avatar.
GetBoneRotation
public static Quaternion GetBoneRotation(Bone bone)Rotation of a bone of the local avatar, in the world; identity without an avatar.
Teleport
public static void Teleport(Vector3 position, float yRotationDegrees)Moves the origin of the local player's play space (TrackingPoint.Origin) to position, turned yRotationDegrees (the client keeps its own safety checks). On desktop the player stands on it; in VR the head keeps its place in the room.
public static void Teleport(Vector3 position, Quaternion rotation)Moves the origin of the local player's play space to position, turned and tilted to rotation: a seat that pitches and rolls with a vehicle tilts the view with it. Teleport(position, yRotationDegrees) and Respawn set it upright again.
Respawn
public static void Respawn()Takes the local player back to the spawn point of the world.
PlayHaptic
public static void PlayHaptic(Hand hand, float duration, float amplitude, float frequency = 320f)Vibrates a controller (VR).
