So this is my Rocket League spinoff summer project.
My car just stops and jumps. I want it to be able to jump straight up when not moving and keep momentum when it is moving and in the air. This is a newb way to write this code. Let me know if you have any suggestions. Thanks!
using UnityEngine;
using System.Collections;
public class Jump : MonoBehaviour
{
public Rigidbody truck;
void Start()
{
truck = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.B))
{
truck = GetComponent<Rigidbody>();
truck.velocity = new Vector3(0, 7, 0);
}
else if (Input.GetKeyDown(KeyCode.LeftControl)) {
truck.velocity = new Vector3(0, 3, 4);
}
}
}
Let me know if there is something I am missing. I am on 5.3.5f1,