Teleporting the Player
From CryWiki
| ||||||||
This tutorial will teach you how to use the flowgraph feature to teleport a player when he steps inside a proximity trigger.
Contents |
Setting the Destination
We are going to use a AI TagPoint to specify where we want the player to be beamed to.
In the RollupBar, click the AI button under the Create tab. Then select TagPoint and place it where you want the player to teleport to.
Once you're done, name the tagpoint beamplace
Setting the Start Position
We are going to use a ProximityTrigger to detect when a player has entered an area. When it's triggered, it's going to start the flowgraph for us.
In the RollupBar, click the Entity button. Then drag the ProximityTrigger from the Triggers folder.
Create the Flowgraph
Now, click the Create button under the property editor's Flow Graph section.
Name it Teleport.
Creating the Nodes
Now we need to add a ProximityTrigger node to our flowgraph. Whenever the player steps inside this volume, the ProximityTrigger will cause this flowgraph to execute. Right click in the flowgraph editor and select Add Selected Entity
Then, add a Localplayer node to our flowgraph by right clicking and selecting Add Node→Game→LocalPlayer from the popup menu.
Using the same steps, add the following nodes
- BeamEntity node from Entity/BeamEntity
- GetPos node from Entity/GetPos
Now we need to assign a entity to the entity input port (aka Choose Entity). First select the beamplace tagpoint from the 3D view. Then right click the red Choose Entity port and select Assign selected entity from the popup menu.
Connecting the Ports
Connecting the ports allow a node to use another node's output as its input.
To connect a output port to a input port, click and drag from the output port's arrow to the input port's arrow. You should see a curvy arrowed line appear.
Now, connect the following ports:
- ProximityTrigger's enter to Entity:GetPos' Get
- ProximityTrigger's enter to Entity:BeamEntity's Beam
- Game:LocalPlayer's entityId to Entity:BeamEntity's <Input Entity>
- Entity:GetPos' Pos, Rotate and Scale to Entity:BeamEntity's Position, Rotation and Scale
You should see something similar to this after you're done. Don't worry, the HUD Overlay Text isn't mandatory, it just shows a message on your HUD once you have been beamed.
Results
Walk into the ProximityTrigger, and you should be teleported.









