RoomRotator
A class in Root.Township, the global namespace.
Controller extension that turns the local VR player with snap or smooth rotation, following the turn settings. Client only; one per hand controller.
- Listed in Global namespace: Q to R
- Inherits or implements
ControllerExtension
Constructors
| Member | What it is |
|---|---|
RoomRotator() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private float currentMultiplier | Smooth turn speed multiplier picked from the speed setting. |
private float currentSensitivity | Swipe sensitivity multiplier picked from the settings. |
private bool isClockwise | Direction for RotateJustVRControls. Flipped for the left hand. |
private bool isOnRelease | When true, snap turns happen on button release rather than press. |
private bool isRotatingAroundPlayerNotRoom | When true, turns around the player's position; otherwise uses the locomotion controller's plain RotateTo. |
private bool isUsingPlayerTeleportSettings | When true, the turn uses the player's teleport style (fade or lerp) instead of instant. |
private PlayerController playerController | The player controller being turned. |
private float rotationAmount | Snap turn angle in degrees. Defaults to 90. |
private float[] sensitivityMultiplier | Multipliers for the four swipe sensitivity levels. |
private AnimationCurve smoothRotationSpeed | Curve from input to turn speed for smooth turning. |
private float[] smoothRotationSpeedMultiplier | Multipliers for the four smooth turn speed settings. |
private IUnityUpdateMethod update | Handle for the registered smooth turn update. |
private static UpdateModule updateModule | Shared update module all room rotators register their smooth turn with. |
Methods
| Member | What it is |
|---|---|
protected override void Awake() | Finds the player controller, flips direction for the left hand and listens for settings changes. |
18 private and internal methods
| Member | What it is |
|---|---|
private void CheckSettings(Settings obj) | Re-applies the turn mode when game settings change, if enabled. |
private void Disable() | Unhooks all turn actions and the smooth turn update. |
private void Enable() | Hooks snap turn actions or a smooth turn update to match the settings, and reads speed and swipe sensitivity. |
private void OnDestroy() | Stops listening for settings changes. |
private void OnDisable() | Stops listening for new controllers and unhooks all turning. |
private void OnEnable() | Listens for the controller arriving and sets up turning once it has. |
private void ProcessInput(float input) | Smooth turn step: scales the input, runs it through the speed curve and turns, if the hand is free. |
private void RotateJustVRControls(PlayerInput controller) | Turns the play space by rotationAmount while putting the body back where it was. |
private void RotateJustVRControls(PlayerInput controller, bool isDisabling) | Turns the play space by rotationAmount while putting the body back where it was. |
private void RotateRoom(int direction, float rotationAmount) | Turns the player by an angle around the player (or the room), unless locomotion is blocked. |
private void RotateRoomLeft(PlayerInput controller) | Snap turns left by rotationAmount if the hand is free. |
private void RotateRoomLeft(PlayerInput playerInput, bool isDisabling) | Snap turns left by rotationAmount if the hand is free. |
private void RotateRoomRight(PlayerInput controller) | Snap turns right by rotationAmount if the hand is free. |
private void RotateRoomRight(PlayerInput controller, bool isDisabling) | Snap turns right by rotationAmount if the hand is free. |
private void RotateRoomSwipe(PlayerInput playerInput) | Snap turns in the swipe direction on OpenXR controllers with a swipe pad. |
private void ThumbstickSmoothRotation() | Per-frame smooth turn from the left and right turn actions, scaled by stick amount. |
private void TouchPadSmoothRotation() | Per-frame smooth turn from the swipe pad while it is touched. |
private void UpdateController(PlayerInput input) | Calls Enable a frame later when a new controller is received. |
Used in
Members of other types that take, return or hold a RoomRotator: