This is my first character control script.
the cube should be able to jump (failed)
I want to make the cube jump but it just sticks to the ground. When gravity is turn on it jump but does not move forward and when gravity is turn off it moves forward but when pressed Jump it does not come down continuously move up.
void FixedUpdate ()
{
Vector3 vel = rigidbody.velocity;
vel.x = Input.GetAxisRaw("Horizontal") * MaxHorSpeed;
if (Input.GetKeyDown(KeyCode.Space) && IsGrounded()){
vel.y = jumpSpeed;
}
}