NodeWorld

Player

La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.

csharp
public static class Player

Namespace 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

csharp
public static Vector3 position { get; }

Position of the local player in the world.

rotation

csharp
public static Quaternion rotation { get; }

Rotation of the local player in the world.

headPosition

csharp
public static Vector3 headPosition { get; }

The head (camera) of the local player.

headRotation

csharp
public static Quaternion headRotation { get; }

Rotation of the local player's head (the camera).

isInVR

csharp
public static bool isInVR { get; }

The local player plays in a VR headset.

id

csharp
public static int id { get; }

Id of the local player in the room (0 on the server).

name

csharp
public static string name { get; }

The display name of the local player.

accountId

csharp
public static string accountId { get; }

The NodeWorld account of the local player: the same in every room and every visit.

language

csharp
public static string language { get; }

The language of the player's client ("fr", "en"...); OnLanguageChanged tells a change.

isMaster

csharp
public static bool isMaster { get; }

The local player is the master of the room.

isGrounded

csharp
public static bool isGrounded { get; }

The local player stands on the ground.

velocity

csharp
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

csharp
public static float walkSpeed { get; set; }

Walking speed of the local player.

runSpeed

csharp
public static float runSpeed { get; set; }

Running speed of the local player.

strafeSpeed

csharp
public static float strafeSpeed { get; set; }

Sideways speed of the local player.

jumpImpulse

csharp
public static float jumpImpulse { get; set; }

Vertical speed of a jump (m/s); 0: no jump.

gravityStrength

csharp
public static float gravityStrength { get; set; }

Multiplier of the gravity on the local player (1: normal, 0: none).

immobilized

csharp
public static bool immobilized { get; set; }

The player cannot walk (its input is ignored); the world may still move it.

sittingPoint

csharp
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

csharp
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

csharp
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

csharp
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

csharp
public static Vector3 GetBonePosition(Bone bone)

A bone of the local avatar (world space); Vector3.zero without an avatar.

GetBoneRotation

csharp
public static Quaternion GetBoneRotation(Bone bone)

Rotation of a bone of the local avatar, in the world; identity without an avatar.

Teleport

csharp
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.

csharp
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

csharp
public static void Respawn()

Takes the local player back to the spawn point of the world.

PlayHaptic

csharp
public static void PlayHaptic(Hand hand, float duration, float amplitude, float frequency = 320f)

Vibrates a controller (VR).