Hey guys,
I got this code from the unity script reference and I’ve been trying to add Jump function to it, I cannot work out how. I tried using the adforece.up and also tried to use the other move direction from another reference i couldnt work it. Ive also looked everywhere online but cant find a way to do it, can anyone help me with this please?
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour {
public float speed = 10.0f;
public float rotationSpeed = 100.0f;
public float jumpSpeed = 8.0f;
public float gravity = 20.0f;
void Update() {
float translation = Input.GetAxis("Vertical") * speed;
float rotation = Input.GetAxis("Horizontal") * rotationSpeed;
translation *= Time.deltaTime;
rotation *= Time.deltaTime;
transform.Translate(0, 0, translation);
transform.Rotate(0, rotation, 0);
}
}