NodeWorld

NWPlayerControls

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

csharp
public sealed class NWPlayerControls : MonoBehaviour

Namespace NodeWorld.SDK.Client.XR.

What the world may do to the local player's locomotion (FL# scripts: Player.walkSpeed, gravityStrength, velocity, immobilized...), on the player rig (VRPlayerController). It runs before the desktop controls (-220) and the XRI locomotion providers (-210), which read the speeds it sets: - walk / run / strafe speeds, jump impulse, gravity multiplier; - immobilization: the player's own walking and jumping are off (the move provider does not even touch the character controller, so a world may hold the player where its collider overlaps the scene, as a seat does); - a velocity the world gives: the player then moves by it, gravity (times its multiplier) bends it, the ground slows it down; the player's own locomotion is back once it has stopped. It also reads the input of the player for the world (keys, buttons, axes) and plays haptics. The keyboard and the mouse buttons are read through the TypingGate: while a text field is typed in, the world hears no key. The keys of the application (ClientKeys: Escape, Tab, P, Shift+R) and the controller button of the menu never reach it.

Properties

WalkSpeed

csharp
public float WalkSpeed { get; set; }

Speeds the world asks (m/s); NaN: the rig's own.

RunSpeed

csharp
public float RunSpeed { get; set; }

The running speed the world asks, in meters per second; NaN: twice the walking speed.

StrafeSpeed

csharp
public float StrafeSpeed { get; set; }

The sideways speed the world asks, in meters per second; NaN: the walking speed.

JumpImpulse

csharp
public float JumpImpulse { get; set; }

The jump impulse the world asks, in meters per second; NaN: the rig's own jump.

GravityStrength

csharp
public float GravityStrength { get; set; }

Multiplies gravity for the local player (1: normal).

Immobilized

csharp
public bool Immobilized { get; set; }

The player's own walking and jumping are off.

SittingPoint

csharp
public Transform SittingPoint { get; set; }

The local avatar sits on this point in its sitting pose (FL# Player.sittingPoint); null: it stands. The world places the player, as a seat does.

CurrentWalkSpeed

csharp
public float CurrentWalkSpeed { get; }

The walking speed now (world's, or the rig's own).

CurrentRunSpeed

csharp
public float CurrentRunSpeed { get; }

The running speed now (Shift on desktop, the stick pushed fully in VR): the world's, or twice the walk.

CurrentStrafeSpeed

csharp
public float CurrentStrafeSpeed { get; }

The sideways speed now (world's, or the walking speed).

CurrentJumpImpulse

csharp
public float CurrentJumpImpulse { get; }

The jump impulse now (world's, or the rig's own jump height).

LocomotionLocked

csharp
public bool LocomotionLocked { get; }

The player's own walking is off (immobilized, or moved by a velocity the world gave).

IsDesktop

csharp
public bool IsDesktop { get; }

The player plays without a headset (keyboard and mouse).

Velocity

csharp
public Vector3 Velocity { get; set; }

The player's velocity. Setting it gives the player a velocity the world chose: gravity bends it, the ground slows it, then the player's own locomotion is back.

IsGrounded

csharp
public bool IsGrounded { get; }

The player stands on the ground.

Methods

ResetWorldSettings

csharp
public void ResetWorldSettings()

The world unloads: everything back to the rig's own settings.

GetKey

csharp
public bool GetKey(string keyName, int query)

A key as the world asks it (its Input System name; query 1 held, 2 pressed this frame, 3 released this frame), through the TypingGate; the keys of the application (ClientKeys) always read released.

GetButton

csharp
public bool GetButton(int button)

Buttons as the world names them (InputButton): 1 jump, 2 use, 3 grab, 4/5 triggers, 6/7 grips, 8/9 primary, 10/11 secondary, 12 down. The button of the menu (ClientKeys.MenuButton) always reads released.

GetButtonDown

csharp
public bool GetButtonDown(int button)

The button was pressed this frame (InputButton numbers, as GetButton).

GetButtonUp

csharp
public bool GetButtonUp(int button)

The button was released this frame (InputButton numbers, as GetButton).

GetAxis

csharp
public float GetAxis(int axis)

Axes as the world names them (InputAxis): 1/2 move, 3/4 look, 5/6 triggers, 7/8 grips.

TryGetTracking

csharp
public bool TryGetTracking(int point, out Vector3 position, out Quaternion rotation)

A tracked pose in world space (TrackingPoint): 0 the head, 1 / 2 the left / right hand, 3 the origin of the play space (the rig).

PlayHaptic

csharp
public void PlayHaptic(int hand, float duration, float amplitude, float frequency)

Vibrates a controller: hand 1 left, 2 right; duration in seconds (10 at most), amplitude from 0 to 1.