Hello, so i’m currently learning unity and scripting but i can’t seem to find a way to max the height a object can jump. This is my script atm and i know its very plain lol.This is still my first try tbh.
using UnityEngine;
using System.Collections;
public class Cube : MonoBehaviour {
public float moveSpeed;
// Use this for initialization
void Start ()
{
moveSpeed = 5f;
}
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown(KeyCode.Space)){
GetComponent<Rigidbody>().velocity = Vector3.up * moveSpeed;
}
transform.Translate (moveSpeed*Input.GetAxis("Horizontal") * Time.deltaTime, 0f,moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
}
}