Deactivating stick movement  [Optional] 

The OVRPlayerController prefab includes the OVRPlayerController script. This script does many things right, but it also facilitates stick movement. Stick movement uses the touch controller's analog sticks for directional movement and rotation. During development, it provides a quick means to move around the scene while in VR. But in practice, it induces motion sickness for the following reasons:

  • It introduces non-forward motion
  • It increases vection
  • It moves yaw control to the touch controller

We generally eliminate stick movement, or at least expose the feature in the Inspector so it can be controlled. The following steps are optional, but highly recommended for player comfort:

  1. Locate the OVRPlayerController script in the Project window. In version 1.21.0, the script can be found her OVR | Scripts | Util.
  2. Open the script in a script editor.

The script controls player movement in the UpdateMovement () function. This function contains a series of if statements which control when and how movement should occur. In theory, we could go through and comment out several lines to achieve our goal of deactivating stick movement. But instead, we will simply take advantage of the existing formula used to compute the move distance.

  1. Locate the private float SimulationRate and set its value to zero. Since this variable is used to compute the linear distance of movement from the controller, setting its value to zero will stop all stick movement. Unfortunately, the variable is also used to compute the speed at which gravity affects the player during freefall. To fix this, we will create a new variable for falls.
  2. On the following line, create a new float named FallRate and set its value to 60f.
  3. Change the variable SimulationRate to FallRate in the following statements:
(~Line 208)
FallSpeed += ((Physics.gravity.y * (GravityModifier * 0.002f)) * SimulationRate * Time.deltaTime);

(~Line 210)
moveDirection.y += FallSpeed * SimulationRate * Time.deltaTime;
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.113.55