Setting Up the Action Maps
Action maps are used when you want to change the inputs for different tasks. My case is switching from Player to Driving modes.
I only set one action for the player to demonstrate the switch when I press T.
In the driving action map, I set the actions to follow Vector 2 and I added a way to switch back to the Player action map.
Don’t forget to generate a C# class of this InputAction asset in the Inspector.
Switching Action Maps in Script
Get a reference to the InputActions asset>Enable the Player action map>then setup what the EnterCar action does.
So, when you hit T in Player mode, I made a log saying that I entered the car>Disabled Player>Enabled Driving>Then set what happens when I press T again while in Driving mode.
Simple Driving Code
When in driving mode and press WASD, it gives a value. I just read the Vector2 values and set them to their corresponding axis.
To move forward in 3D space, you either use x or z. Using y would just raise the player.
Then to rotate the car, I set left and right to rotate on the y axis.
That was how to switch action maps using code!
Next up, setting up different taping and holding actions!
See you then!