What we mean by locomotion direct control is that the user can move themselves freely in the VR space. The ideal movement in VR is to allow the user to move the same in real space as they do in VR within their VR play space. This is obviously constrained by the play space the user can set up based on their hardware or location. In some cases you may want to give them broader freedom to move around a larger environment than their play space would allow. There are a number of ways to make this feel more natural by using story or objects to explain the freedom of movement.
VR Sickness and Direct Control
There are a couple different things to consider when giving the player the ability to move themselves in space in VR
1. Movement Direction – People generally move forward in the real world (we don’t usually walk backwards or sideways). Giving the user the ability to move backward or side to side (strafing) is fairly unnatural and can impact nausea.
2. Speed – The speed of movement can also increase nausea. It has been shown that normal rates of movement may actually be the most disorienting with slow speeds and rapid speeds resulting in less discomfort.
3. Acceleration and deceleration – As much as possible keeping the user at a constant speed will help. It is also important to try to keep movement as smooth as possible.
A. Adjusting default animation style to remove subtle changes at the beginning and end of movements.
B. Reduce lag of input and movement – using long movement animations will result in motion continuing after the input has been removed which can impact nausea.
4. Orientation – Changing the users up and down orientation can cause one of the more jarring disconnects between the body and the eyes. When deciding which directions to allow the user to manipulate be careful when allowing them to tilt their orientation relative to the ground.
Camera SetUp for VR
The default camera in Alice is set up to have a slight downward angle. When you first start your VR project or are translating an existing world to VR be sure to use the following to straighten out the Camera view to avoid the disorienting feeling of being slightly tipped forward.
1. Go to the Scene Editor
2. Select the Camera
3. Select One Shots
4. Select OrientToUpright
Move Using the Joystick or D-Pad Quick Start
The Alice arrow key inputs map to the VR controller Joystick or d-pad. The fastest way to set up user direct controls is to implement the keyboard event addObjectMoverFor and attach it to the camera.
This built in control will give the user the following controls:
Up Joystick – Move Forward
Down Joystick – Move Backward
Right Joystick – Turn Right
Left Joystick – Turn Left
While we do not expose the parameters on the defaultObjectMove for it behaves as if the following parameters have been set:
Held Key Policy: Fire Multiple – This means you can hold the joystick in the direction and it will continue to trigger the movement
Multiple Event Policy: Combine – This means you can hold the joystick in a diagonal direction and the forward/backward and turn will both be processed at the same time.
The defaultObjectMoveFor solution also adds a parameter that constrains all movements to the X,Z or ground plane. Even if you do not follow the VR set up and reorient the camera to upright (or make sure an object is oriented to upright) the movements will keep you level with the ground plane.
To set this locomotion up do the following:
1. Navigate to initialize eventListener tab
2. Select Add Event Listener
3. Select Key Press Event
4. Select addObjectMoveFor
5. Select Camera
You can view an example of this construction by loading the vrLocomotionDirectControlDefault.a3p
Move Using the Joystick or D-Pad Flexible
The built in addObjectMoveFor works great for a lot of implementations but in some cases you may want more control over the direction or speed of the moves. For more flexibility you can construct your own arrow keypress events to connect them with the joystick or d-pad inputs.
Option A:
In this example we have set the following parameters and values:
HeldKeyPolicy = Fire_Multiple: We want the movement to continue when you hold the joystick in a direction.
MultipleEventPolicy = Ignore: We want them to continue but not to stack causing an acceleration. Try this both ways to see the difference.
AnimationStyle = Begin_And_End_Abruptly: The default Begin_And_End_Gently causes each separate move to speed up and slow down. To create a smooth constant speed we want each separate move to have a consistent speed. Try this both ways to observe the difference (It may be less obvious with shorter durations and distances).
Distance/Turn Amount: Changing the distance will impact the speed of the directional movement. We have set 1 meter for forward and backward which is fairly quick. The larger the amount of the turn the faster the turn input will spin the object. We have set it as .01 for the turn because a large number here will cause a jarring spinning motion. Play with these values to see the effect.
Duration: We have chosen a shorter duration so that when you release the joystick the movement will end more quickly and feel more direct. Play with this value to see how it affects the movement after the input is released.
We separated these events into two events grouping them by events that can’t be simultaneously triggered (you can’t push the joystick forward and backward at the same time). We did this because the ignore parameter will only allow one move or turn to be processed at a time. Try putting all of them in the same event to see what happens.
You can view an example of this construction by loading the vrLocomotionDirectControlCustomKeypressOptionA.a3p
Option B:
In the above example we have put all of the directions into one event. To make this work we have set the following parameters and values:
MultipleEventPolicy = Combine: This allows this event to process multiple conditions at the same time. In this case it will process both a forward or back and a left or right at the same time.
Duration = .03: This duration was chosen because Alice will process up to 30 input per second. By choosing this duration we are ensuring that two moves/turns in the same direction will not be processed at the same time and be combined into a larger move. Try increasing this number to see what happens when multiple move/turn procedures of the same input begin to process at the same time.
To create your own key event you will:
1. Navigate to initialize eventListener tab
2. Select Add Event Listener
3. Select Key Press Event
4. Select addArrowKeyPressEvent
5. Add an if/Else conditional block into the event
6. Replace the true/false default with an event isKey ??? function from the event
7. Select which key you want to add an outcome for remembering the mapping to the joystick and d-pad
8. Add the movement or turn you want associated with the input
9. Continue adding till you have all of the inputs you want and try out the different approaches shown above
When creating your own custom keypress to move, turn or roll the camera or an object unlike the defaultOjectMoveFor the move, turn or roll will be relative to the camera/object orientation not the ground plane. Leaving the default camera setup with a slight turn forward will result in the forward movement moving the camera forward at a down angle eventually moving you through the ground and a backward movement raising you backward up into the air.
You can view an example of this construction by loading the vrLocomotionDirectControlCustomKeypressOptionB.a3p
Tuning the Movement
Following this same construction pattern you can now pick and choose the directions you want to apply to each direction on the joystick or d-pad. This gives you all of the options for moves, turns and rolls. To make adjustments to the speed the user will move and turn through the world you can adjust the distance or rotation values and the duration. It is a good idea to keep the duration low to avoid latency of movements continuing after the user has released the input. Remember the points made above related motion sickness and movement in VR. Set your speeds to be slower than normal, regular movement rate, and fast and see how they make you feel. Be very careful when using turn not create extreme spin effects like a rida at a carnival unless your user knows what they are in for.
You can use the combine option shown in Option B to create smooth acceleration and deceleration. Try starting with the duration of the procedure at .033 and slowly increase the duration of the move procedure and observe the stacking of the movements and the slow unstacking after you release the key.
Using The Headset Orientation
We are working to implement returning the headset orientation so that it can be used in programming. Check back for the release of this feature. The goal will be to allow you to set up moves based on the orientation of the headset or the camera object separately. This will allow you to program functionality using as seen by the headset as a parameter. An example of how this could be used would be to program up on the joystick to move forward based on which way the user is looking giving a more direct correlation between the users orientation and the user input.
Using a Vehicle with a Camera
Direct movement can feel odd in VR since you are not actively participating in the locomotion with your body. Lot’s of VR worlds solve this by having the user control a vehicle object like a car, moped, jetpack or something else that will explain the disconnect between the input and the motion and lack of movement of your body. If you elect to have the user ride on a boat or other vehicle you will want to set your cameras height to 1.56 meters above the vehicle and center it where you want the user to be situated. If you plan on having the user seated in vr adjust the height accordingly.
1. Place your vehicle and orient the camera relative to the vehicle object
2. Select the camera and set vehicle to the vehicle object
3. Go to Code Editor
4. Navigate to initialize eventListener tab
5. Select Add Event Listener
6. Create and object move for the vehicle object/or
7. Create a custom key press event and use the vehicle object for the move and turn procedures associated with the inputs
8. Select the vehicle object and implement move/turn procedures for the vehicle attached to the key press
You can view an example of this construction by loading the vrLocomotionDirectControlCustomKeypressOptionVehicle.a3p