Hotspots | How To Setup Virtual Reality in Unreal Engine
Welcome back! Louie here again, today I want to share with you a new tutorial on how to set up a simple hotspot system. This makes it really easy to view your scene from different angles by just the tap of a button, hopping from one to the next. This makes it especially easy for users who may not be that confident with the technology yet.
One of the main problems facing Virtual Reality at the moment is ‘simulator sickness’; this can be a slight issue when introducing Virtual Reality to new users. Since our technology is being used for Architectural Visualisations, the main core audience will almost definitely be people who have never encountered Virtual Reality before. From a lot of experience, the best way to avoid this is to transport from hotspot to hotspot, reducing motion from the camera. There has been a lot of research into Simulator Sickness including findings that motion in your surroundings, whilst maintaining one position such as sitting in moving car is a feeling that most of us can relate to; this feeling also rings true with Virtual Reality. The Department of Computer Graphics Technology at Purdue University uses the idea of keeping one stable reference too, such a as a virtual nose in the scene the reduce the feeling of sickness.
Simulator Sickness aside, let’s get stuck in how to create a simple hotspot system.
To begin, you need to drag the VR Camera you previously made into the scene and place it on the floor, in the position you want to see from. The direction the camera is facing is the default forward position, so rotate the blueprint if needed to face the correct direction.
Now, you might want to switch between a few hotspots so you can take a look at your scene in VR from different places. To do this, duplicate your blueprint in the scene a few times and position them where you want.
Next, you need to make it so you can actually swap between the cameras. Simply hit the arrow next to the Blueprints icon at the top and go to Open Level Blueprints.
Then you need to add another Event Begin Play just like before so that we can set it to possess the first camera as soon as it starts.
You then should add an “Enable HMD” node and set it to active, making sure it’s connected to the Event Begin Play. This will make sure that no matter if you run this through the editor or compiled, it will automatically start playing in VR.
Next, make a new node called Possess which is the basis for controlling the VR Camera we just made.
Attached to this you need to set a target. To do this, create a Get Player Controller node and connect it to the target in the Possess node. This now means that we the player controlling are the target that will possess the pawn.
Next we need to connect the first VR Camera to this. To achieve this, we need to go back to the main editor. Select the cameras in the scene from the World Outliner and drag them across into the world blueprints. This should create new small nodes with the names of the cameras, so we can make them interact with what we want to do in the Level Blueprints. Note: this only works for connecting blueprints in a scene to the level blueprints. If you want to connect a blueprint to another blueprint you need to use a different method like Event Dispatchers or Functions.
Now that we have the blueprint nodes into the Level Blueprints, we can connect the first VR Camera to the possess node to complete it. When you start the scene, you will start controlling that camera.
You should now make it so you can swap between the cameras. To do this you can create a node linked to a keypress. For this example I will use the Enter Key. You just need to type the word Enter into the normal action list and select it.
Following that, we need to create what’s called a Multigate. This node will activate a different path each time it is activated, in this case, by the enter key.
Once the Multigate is created, we will need to activate the Loop option so that when the gate reaches the bottom, it will restart at the top. Next you will want to go to add pin as many times as you have cameras. In this case there are 3 cameras so I made 3 out pins.
Next we need to make three Possess nodes for each camera to attach to. These will then need to be attached to each out pin of the multigate.
Finally, all you need to do is join the rest of the nodes up to their respective places. The targets should be the Get Player Controller node, the VR Cameras should be put in order of 2nd camera onwards until it reaches the end, then the last should be the camera you start on. This will ensure it seamlessly loops between the cameras.
Now that you are all done, you can go ahead and click the arrow next to the play icon, then click on VR Preview. This will open up the scene in VR mode so you can test it out. When you hit enter you will swap between the cameras you placed until you reach the end, when it will go back onto the first camera.
Have fun hotspoting!