Hi everyone, got a question regarding the Input.GetAxisRaw command. Are “Horizontal” and “Vertical” the only two choices available? I’m working on the 2D Platformer tutorial and am adding my own twist to the game. I have Lerpz moving and jumping well on the horizontal but I want the player to have a choice of either pressing the UP arrow or DOWN arrow and the camera will shift either up or down. When it comes to vertical, the camera moves only up with the code below. How can I make the camera move down as well? Any help would be highly appreciated, thanks in advance. NOTE: I’m still a javascript rookie ![]()
2D Platformer tutorial:
function UpdateSmoothedMovementDirection () {
var h = Input.GetAxisRaw ("Horizontal");
if (!canControl)
h = 0.0;
movement.isMoving = Mathf.Abs (h) > 0.1;
if (movement.isMoving)
movement.direction = Vector3 (h, 0, 0);
// return camera to normal eye level
CameraTargetAttributes.heightOffset = 2;
var v = Input.GetAxisRaw ("Vertical");
if (!canControl)
v = 0.0;
movement.isLookingUp = Mathf.Abs (v) > 0.1;
if (movement.isLookingUp)
// move camera up
CameraTargetAttributes.heightOffset = 4;
var d = Input.GetAxisRaw ("Vertical");
if (!canControl)
d = -0.0;
movement.isLookingDown = Mathf.Abs (d) < 0.0;
if (movement.isLookingDown)
// move camera down
CameraTargetAttributes.heightOffset = -4;