Hey, Peeps! In this tutorial, we're gonna make our second game in VR, after that Roller Coaster game from a while back. You will need motion controllers for this one. I am using an HTC Vive in my case. Let's get started!
First, take a new Blueprint project of Virtual Reality template and name it.
After the processing is done, a very basic template is shown. You can't do much in that. So, go to content browser -> VirtualRealityBP -> Maps -> Double Click Motion Controller Map.
Now, if you try this in VR ...
[video width="1918" height="1040" webm="https://diyhacking.com/wp-content/uploads/2017/05/sampleVRrecord.webm" autoplay="true"][/video]
So, in this tutorial, I will show you how you can make objects interactable in a VR environment. We will first learn how we can do that.
You will need the same assets if you want to follow along with the tutorial. You can download them here. Once you've downloaded the assets, go back to Unreal Editor and import the baseball bat FBX model and the materials as well.
Create a new Folder named Assets in Content folder and import the assets in that.
Now with that done, open the baseball bat material and copy the textures in its blueprints.
Thanks to these blueprints, you don't need to know programming to add functionality! You just need to know Zuckerberg's saying - connecting dots!
You can learn about the materials and textures online. Here I will only show you how you can make things work out for you.
Now if you save it and drag the baseball bat into scene view. You can see the textures on it. Now let's play.
[video width="1916" height="1038" webm="https://diyhacking.com/wp-content/uploads/2017/05/batfirst.webm" autoplay="true"][/video]
So, you can see the bat is not interactive. We cannot lift it up or anything.
So, go to VirtualRealityBP -> Blueprints. You will see default blueprints provided by Unreal. You can double click on PickUp_Cube to see its blueprints. It looks like this.
Since we need our bat to behave like an actual bat. We can make a copy of the PickUp_Cube. Go back to the editor and press Ctrl+W to make a copy of it. Name it - PickUp_Bat.
Now, open PickUp_Bat -> Viewport. You will notice there is still a cube there (since we copied it). We'll need to replace it with our assets in the content folder.
Hit Compile and get back to Editor. Now, if you drag that to our scene view. You can notice it interacting.
[video width="1918" height="1032" webm="https://diyhacking.com/wp-content/uploads/2017/05/batWorking.webm"][/video]
That's it for this tutorial. We will finally make our bowling game in the next tutorial.