[Tutorial] 1. Create a VR Character in Unreal Engine 4.
Updated: May 5
In this tutorial, we will create a simple VR Character using the VR Expansion plugin. For installation and setup see the official documentation.
1. Enable the plugin
Open the Projects Settings window and enable The VRExpansionPlugin and the OpenVRExpansion plugin. Then create a new project, select the VR template.
3. Create a character pawn
Create a new blueprint class, set the base class to VRCharacter and name it VRPawn.
4. Add the hand meshes
In the component windows we have a LeftMotionController and a RightMotionController component. Add a Skeletal Mesh component to each of these controllers, and rename it to HandMesh - Left, and HandMesh - Right.
Set both the Skeletal Meshes to MannequinHand_Right.
5. Create a custom game mode
Create a new blueprint class, based on GameMode, call it VRGameMode. Then, in your world settings set the game mode to VRGameMode. Set the default pawn class to VRPawn.
You can open the world settings from the Windows menu.
Now, if you hit Play in VR Preview, you should be able to see your hands. However, there a are a few issues. First, the hands don't correspond to the real world location of the controllers, and the camera is below the floor level. Let's fix that:
Open the Event graph of VRPawn and add to following to the Begin Play event:
Then change the transform of the hands to match the position of the controllers, or use these values:
Don't forget to set the scale.Z for the left hand to -1, otherwise it will be same as the right hand. Now, your hand should be positioned correctly in game.
6. Add basic locomotion
To add basic locomotion, add the following to the event graph of the VRPawn:
Now you should be able to move around the scene :)
In the next tutorials we will implement basic gripping and hand animations.