From f659edd3d0c8385ea01bf1d315e3acb54a11d4fd Mon Sep 17 00:00:00 2001 From: "Theston E. Fox" Date: Tue, 31 Jan 2017 21:22:33 +0000 Subject: [PATCH] feat(Locomotion): add falling deceleration to MoveInPlace The MoveInPlace script now has a separate deceleration setting for when the player is falling giving a more refined feel to falling off ledges and not abruptly slowing down. --- Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs | 4 +++- DOCUMENTATION.md | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs b/Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs index e50078742..40a63f67d 100644 --- a/Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs +++ b/Assets/VRTK/Scripts/Locomotion/VRTK_MoveInPlace.cs @@ -58,6 +58,8 @@ public enum DirectionalMethod public float maxSpeed = 4; [Tooltip("The speed in which the play area slows down to a complete stop when the user is no longer pressing the engage button. This deceleration effect can ease any motion sickness that may be suffered.")] public float deceleration = 0.1f; + [Tooltip("The speed in which the play area slows down to a complete stop when the user is falling.")] + public float fallingDeceleration = 0.01f; [Tooltip("How the user's movement direction will be determined. The Gaze method tends to lead to the least motion sickness. Smart decoupling is still a Work In Progress.")] public DirectionalMethod directionMethod = DirectionalMethod.Gaze; [Tooltip("The degree threshold that all tracked objects (controllers, headset) must be within to change direction when using the Smart Decoupling Direction Method.")] @@ -290,7 +292,7 @@ protected virtual void FixedUpdate() } else if (currentSpeed > 0f) { - currentSpeed -= deceleration; + currentSpeed -= (currentlyFalling ? fallingDeceleration : deceleration); } else { diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index dcaf95d50..06f596a70 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1107,6 +1107,7 @@ Move In Place allows the user to move the play area by calculating the y-movemen * **Speed Scale:** Lower to decrease speed, raise to increase. * **Max Speed:** The max speed the user can move in game units. (If 0 or less, max speed is uncapped) * **Deceleration:** The speed in which the play area slows down to a complete stop when the user is no longer pressing the engage button. This deceleration effect can ease any motion sickness that may be suffered. + * **Falling Deceleration:** The speed in which the play area slows down to a complete stop when the user is falling. * **Direction Method:** How the user's movement direction will be determined. The Gaze method tends to lead to the least motion sickness. Smart decoupling is still a Work In Progress. * **Smart Decouple Threshold:** The degree threshold that all tracked objects (controllers, headset) must be within to change direction when using the Smart Decoupling Direction Method. * **Sensitivity:** The maximum amount of movement required to register in the virtual world. Decreasing this will increase acceleration, and vice versa.