Teleportation

In this section, we'll go through the main Events and Functions used in the teleportation. The next screenshot of the VR template shows when the teleport is active:

Teleportation starts when the player triggers the TeleportLeft or TeleportRight Events by pressing the thumbstick of the Motion Controller. These Events are implemented in the MotionControllerPawn Blueprint. The next screenshot shows the TeleportLeft Event. When it is Pressed, it activates the teleporter arc of Left Controller, and disables the teleporter arc of Right Controller, because only one can be active. The player points to the desired location, and when they release the thumbstick, the Execute Teleportation Event of MotionControllerPawn is called to perform the camera effect and teleport the player:

In the Activate Teleporter Function of the BP_MotionController Blueprint, the Boolean variables, Is Teleporter Active and Visibility of Teleport Cylinder, are set to True, as shown in the next screenshot. The rendering of the teleport arc is done in the Tick Event if Is Teleporter Active is True:

The Disable Teleporter Function of the BP_MotionController Blueprint resets the variables used in the teleportation and hides Teleport Cylinder.

The Tick Event of BP_MotionController is complex because it deals with the animation of the hand Skeletal Mesh and handles the teleportation arc. The next screenshot shows some Actions of the Tick Event, which are related to the teleportation arc. The Clear Arc Function resets the variables used by the last rendering of the arc. If the Is Teleporter Active variable is True, then the Trace Teleport Destination Function is called to calculate the points that will be used in the ArcSpline Component to render the arc:

We have analyzed the main elements used in the VR template, so now, it will be easier to understand more complex parts of the VR template. If you want to learn more about VR development, then I suggest that you access the Epic Games documentation about VR development: https://docs.unrealengine.com/en-US/Platforms/VR/index.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset