- Home /
How are the Input axes "Horizontal" and "Vertical" mapped to the world axes?
Hello everyone,
Are the Input axes "Horizontal" and "Vertical" mapped to world x & z axes respectively or are they mapped to the screen's x & y axes. Say my character's front (forward vector) was pointing in the same direction as the world forward vector (positive z-axis), but the main camera is rotated slightly, such that its forward vector is not aligned with that of the world. How then would the axes (directions) from Input be mapped?
Answer by Eno-Khaon · Apr 04, 2018 at 07:37 PM
The short answer is that the axes can be mapped to anything you want.
Rather than trying to find the correlation between the world axes and input axes, you should be trying to create the correlation between the inputs and world yourself.
If you're making a game with a 3-Dimensional control scheme, such as a first-person game, then your input axes should be "Horizontal" and "Vertical" relative to your play perspective. Left and Right would strafe left and right, while Up and Down would move forward and backward (by typical, modern standards).
Furthermore, the camera's orientation would only matter if you specifically decide that it should. For example, if the character is facing forward while the camera matches, but is aimed slightly to the character's right, then it's purely at your discretion whether the forward Input will move relative to the character or the camera.
As another angle to look at this from, consider "Tank Controls" as a scheme: The character moves from a third-person perspective, yet the "Horizontal" control axis turns and "Vertical" axis runs forward and backward for the character. The direct alternative to this is when the "Vertical" axis will always move the character toward or away from the camera (and "Horizontal" will move left or right relative to the camera), automatically turning to face those directions based on the Input provided.
So, really, there's no simple answer to this because there is NO predetermined answer to this. There are typical conventions to reference for how a control scheme is generally devised for a type of game, but nothing is set in stone. Tastes change. Styles change. Impressions change. The more games are made, the more ways there become to play them, and the more interpretations there will be for input to correspond to gameplay.
Answer by godfreyidk · Apr 05, 2018 at 04:13 PM
Thank you for that thorough answer. I'll ponder on it. Cheers
Your answer
Follow this Question
Related Questions
transform.position is giving me local space 1 Answer
Specific use of TransformDirection 0 Answers
About World space and Local space 4 Answers
WorldSpace movement? 1 Answer
Applying Constant Force to Object A using Object B's Vectors. 0 Answers