How to beam the player to a tag point from a trigger

In this recipe, we will demonstrate a basic use of setting up a trigger area and then teleporting the player to a particular location once the player walks inside that trigger area.

Getting ready

  • Before we begin, you must have the Sandbox open
  • Then open My_Level.cry

How to do it...

  1. In the RollupBar, click on the Entities button.
  2. Under the Triggers section, select ProximityTrigger.
  3. Place this ProximityTrigger on the ground with the following property changes:
    • DimX = 10
    • DimY = 10
    • DimZ = 5
    • OnlyPlayer = True
  4. Next, draw down a solid to mark the area where we might see the trigger area that the player needs to enter. Match the dimensions to the following—10x10x1 meter.
    How to do it...
  5. Next, place down a tag point to reference as the beaming destination.
  6. In the RollupBar, click on the AI button.
  7. From the Object Type, select Tagpoint.
  8. Place the tag point several meters away from the trigger.
    How to do it...
  9. And finally, we need to create the logic within the Flow Graph to trigger the beaming event for the player.
  10. Right-click the ProximityTrigger | Create Flow Graph.
  11. Name the Flow Graph Beam_Trigger and click OK.
  12. Go back into the editor's perspective viewport and select the ProximityTrigger.
  13. Open the Flow Graph editor again and select the ProximityTrigger within the FG hierarchy.

    Note

    You can re-open the Flow Graph from the main Tool Bar | View | Open View Pane | Flow Graph.

  14. Right-click in an open space and click Add Selected Entity.
  15. Repeat steps 3 to 5 for the tag point.

    Note

    You can also select multiple entities and add them all at the same time within the Flow Graph.

  16. Right-click Add Node | Entity | Beam Entity.
  17. Then right-click Add Node | Game | Local Player.
  18. Link the Enter output from the ProximityTrigger to the input of Beam on the BeamEntity node.
  19. Link the entityId of the LocalPlayer node to the input of Choose Entity in the BeamEntity node.
  20. Link the pos output from the Tagpoint node to the Position input on the BeamEntity node.
    How to do it...

Now every time the player walks into the defined proxy trigger area, the player will be beamed to the tag point's world coordinates.

How it works...

Beaming within CryENGINE 3 is like instantly teleporting an entity to any defined location in the level. With this setup, we are telling the code to beam the player to the tag point's defined Vec3 position within the world as soon as they enter the trigger. This works with any entity type within CryENGINE 3.

See also

  • The Debugging the Flow Graph recipe
..................Content has been hidden....................

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