Changing the player camera through key input
In this recipe, we will look at a simple setup to allow the player to switch from the First Person view to the Third Person view.
Getting ready
Open My_Level.cry
within the Sandbox
How to do it...
Begin by placing an AreaTrigger entity onto the map to use as the container for the Flow Graph.
In the RollupBar, click on the Entities button.
Under the Triggers section, select the AreaTrigger.
Right-click the newly placed AreaTrigger and create a new Flow Graph. Name the Flow Graph as
PlayerViewToggle
.With the Flow Graph open and the new AreaTrigger selected, add in the following nodes:
Game:LocalPlayer
Input:Key
Logic:Sequentializer
3x System:ConsoleVariable
Misc:Start
Set the input Key = g.
Set all three System:ConsoleVariable Cvar=g_tpview_enable.
Set one System:ConsoleVariable Value=1.
Link the Flow Graph together as follows:
Game:LocalPlayer entityId out to Input:Key Choose Entity in
Input:Key Pressed out to Logic:Sequentializer In in
Logic:Squentializer...