top of page
Writer's picturejoshdavidson1

VR Smooth Locomotion System (Josh D.)

In last week's blog, we discussed the research I did behind the character movement. One of the people who provided their input on smooth locomotion was Jonathan Bardwell through his detailed blog and YouTube channel.


Project Set-Up


Custom Inputs

The VR templet that Epic Games provide is an excellent starting point for anyone new to VR as they have the majority of the key bindings mapped out already for the user. However, I did add a jumping action that was bonded to the right B button and a sprinting action that uses the left thumbstick when it is pressed.


Setting up the Motion Controller Pawn

After, having the inputs created I wanted to change the parent type of the motion controller as it was set to a pawn by default. Therefore, changing the parent class to a character allows our VR character to inherit a capsule component and the ability to have gravity affect them.

To make the VR headset adjust to the player height using room-scale the VR origin needed to be set to -90 on the Z-Axis (to match up with the floor of the capsule), which will be discussed further down this blog.

I wanted to set up a branch check to see if the player can teleport as future down development we hope to give the player the choice to pick between smooth locomotion or teleporting, which means we will be able to introduce the foundation of the teleporting mechanic from the templet with adjustments to cater to our gameplay style.


Thumbstick Movement

I wanted to create two variables to store the;

  • Movement Speed - 0.5 (Float)

  • Joystick Dead Zone - 0.2 (Float)

Note: I will be using categories to store the variables as it will make working in a group more organised and easier to read visually.

Walking Left & Right

From the axis value on the motion controller thumbstick X, I used an ABS (Absolute) node as it returns a positive value which saves me from having to do a greater than and less than branch to see if the player is moving left or right. Instead, I can check to see if the ABS value is greater than the Joystick Dead Zone (0.2) for the condition of the branch. If the output is true it will add movement in the direction of the axis value from the joystick. The world direction is set by the right vector of the camera component to get a reference in the direction the player is moving.

Walking Forward & Backward

At this point, I was able to copy and paste all the blueprints from the walk left and right section and connect it to the MotionControllerThumbLeft_Y input. However, instead of using the right vector, I will be using the forward vector to get the direction of the player.

Now after testing it in VR I can move forward, backwards, left and right.


Room Scale Movement

One of the issues I have so far is that the current setup doesn't support the room-scale movement as the capsule component wasn't moving with the player, which doesn't allow our player to experience any real-time collision.


I created a custom event called "UpdateRoomScaleMovement" that will updating using the tick event. To begin, took away the camera and capsules components world locations from one another and set their X & Y values to add them to the actor (player) world offset. Whereas, when adding these values to the VROrigin they need to be opposites so that is why I used the Newgate Vector node as it acts as multiply -1 so it inverts the vector of the camera and capsule to the player's headset camera.

Unfortunately, you cant really notice it in the Gif below but if you look closely you will see the capsule now moving with the player.


Jumping & Sprinting

Using the action inputs I set up at the start I can easily implement jumping and sprinting with some nodes that already exists within Unreal such as the Jump Node.

After testing in VR this is how the jump works within the game, but it may need to be optimised to help the strain of motion sickness.


Crouching

To allow the player to crouch I set up two main custom events "Initalize Capsule Height" and "Set Capsule Height". Firstly, I wanted to focus on setting up "Initalize Capsule Height", to do this I created a variable called "Previours Capsule Half Height" which will be set on begin play event. The previous capsule height is being set to the capsule components half-height (half-height will be set next).

A reference to the capsule component is needed to set the capsule size,


Full Playthrough


Controls Improved By Users

After, having various playtesting sessions within the group and through peers, one thing I discovered was that some users enjoyed using their heads to rotate the body but others felt it made them more motion sick. Whereas, other players preferred using the left stick to snap rotate around the environment as they reported that using this technique rarely made them ever feel sick which was something we did find when doing our research in the planning blog.


Nevertheless, there was a small percentage of testers who didn't enjoy using their head to rotate or using snap rotation, and even know this was such a minimum percentage of people who had issues I felt this still needed to be addressed as our goal was to try and make an enjoyable movement for all users and not just one set playstyle audience.


Therefore, in week 11 I introduced an options menu (can be read about in the Main Menu blog ), that allows the player to switch between snap & smooth rotation as well as toggle the snap rotation between 15 & 30 degrees as from user experience we found that players felt less motion sickness in increments on 15 degrees





10 views0 comments

Recent Posts

See All

Comments


bottom of page