Unreal Engine Virtual Reality Quick Start Guide by Jessica Plowman
Author:Jessica Plowman [Jessica Plowman]
Language: eng
Format: epub
Tags: COM087020 - COMPUTERS / Desktop Applications / Design and Graphics, COM057000 - COMPUTERS / Virtual Worlds, COM051240 - COMPUTERS / Software Development and Engineering / Systems Analysis and Design
Publisher: Packt
Published: 2019-02-28T07:36:44+00:00
The Teleport function
Before we move on to the TraceActivateUp, we need to create a function that can handle the mechanics of the teleport. Over in the Functions section of the My Blueprint panel, click the + button and name the new function Teleport Player. Teleport Player needs to have a couple of input values to work. The first is named Player and will be of the type Actor. The second will be named Loc and this will be of the type Vector.
The teleport itself will require a little bit of math and will need a bit of info from our Player Controller. Let's start the sequence by dragging an execute line from the function node and dropping it to open the search menu. Search for the Cast to PlayerController node and create it. Casting allows us to pretend to be another blueprint and is just one of many ways that allow us to communicate data between blueprints.
Casting requires an Object input, a reference to the specific object we're pretending to be to access its data. To get the exact PlayerController we need, click and drag a line off the Player input on the function node and drop it. Search for the Get Controller node and connect its output to the input on the Cast to PlayerController node.
Next, create a SetActorLocation node. This will do the actual teleporting by moving the player to the designated vector coordinates. Connect the execution output from the cast into the execution input on SetActorLocation. The target input should be set to the Player by dragging a connection from the Player input on the function node to the Target input on SetActorLocation.
It's now time to calculate the new location! To start, we'll need to get the location of two things: the player and the player camera. To get the player's location, drag a line off the Player input on the function node and drop it to open the search box. Search for the GetActorLocation node and create one. We'll need this data in a moment.
Drag a line off the as Player Controller output from our Cast to PlayerController node and use it to search for the Get Player Camera Manager node. Drag off the output of that and search for the Get Camera Location node.
Here is the math part: We need to subtract the location of the player's camera from the location of the player itself to find the true location of the HMD for our teleport. For that, we'll need a Vector - Vector node. The top input will be the vector output from our GetActorLocation node. The bottom input will be the vector from the GetCameraLocation node.
We're almost there! Right-click on the output pin of our Vector - Vector node and split the struct pin. We only need the X and Y value for the next part of the calculation. Create a new Vector + Vector node and split the struct pin on the top input. Connect the X and Y output values from Vector - Vector into the X and Y input values on the Vector + Vector node.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
AI & Machine Learning | Bioinformatics |
Computer Simulation | Cybernetics |
Human-Computer Interaction | Information Theory |
Robotics | Systems Analysis & Design |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7857)
Hadoop in Practice by Alex Holmes(5661)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5514)
Life 3.0: Being Human in the Age of Artificial Intelligence by Tegmark Max(4510)
Functional Programming in JavaScript by Mantyla Dan(3723)
The Age of Surveillance Capitalism by Shoshana Zuboff(3424)
Big Data Analysis with Python by Ivan Marin(3021)
Blockchain Basics by Daniel Drescher(2892)
The Rosie Effect by Graeme Simsion(2710)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2605)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2522)
Applied Predictive Modeling by Max Kuhn & Kjell Johnson(2482)
Dawn of the New Everything by Jaron Lanier(2440)
Test-Driven Development with Java by Alan Mellor(2403)
The Art Of Deception by Kevin Mitnick(2300)
Data Augmentation with Python by Duc Haba(2251)
Rapid Viz: A New Method for the Rapid Visualization of Ideas by Kurt Hanks & Larry Belliston(2195)
The Infinite Retina by Robert Scoble Irena Cronin(2189)
Human Dynamics Research in Smart and Connected Communities by Shih-Lung Shaw & Daniel Sui(2179)