I am making a fps game. Problem is that if the player jumps and and movement force is applied towards another game object then the player will remain in air till the force is removed from that direction. Also player falls slowly and is not giving realistic feeling of jump.
My code is
void Move(float horizontal, float vertical)
{
Vector3 movement = new Vector3 (vertical, 0.0f, -horizontal);
rigidBody.AddRelativeForce (movement * speed * Time.fixedDeltaTime);
rigidBody.velocity = Vector3.ClampMagnitude (rigidBody.velocity, maxSpeed);
}
void Jump()
{
if(Input.GetKeyDown("space"))
{
rigidBody.AddRelativeForce(Vector3.up * jumpSpeed * Time.fixedDeltaTime);
}
}