I am creating a simple 3d side scroller to push my meager knowledge of unity3d and I want to add a jump using the spacebar.
I am ok for the players character to move around while jumping, akin to moving along the ground.
For example if you jumped while moving forward you could drift while jumping to the left or right before landing.
Here is the script I have so far for Player Movement.
// PLAYER CONTROL AND MOVEMENT
var speed = 5.0;
function Update () {
var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
var z = Input.GetAxis("Vertical") * Time.deltaTime * speed;
transform.Translate(x, 0, z);
}
Could I add another line that says
var y = Input.GetAxis(“Jump”) * Time.deltaTime * speed;