# Interpolate problem? Jump isn't smooth...

Hi, I have got a problem with jump… It’s not smooth as I want it… and I haven’t got the idea how to fix it. Here is a video with my problem and my code.

public class Viva_Movement_Rigidbody : MonoBehaviour {

``````[Header("Movement Variables")]
public float moveSpeed = 5.0f;
[Range(0.0f, 10.0f)]
public float jumpSpeed;
public float rotateSpeed = 10.0f;
public bool isGrounded = false;

public float accSpeed = 2.0f;
public float deccSpeed = 0.5f;
public float airDeccSpeed = 0.2f;

public float height = 0.5f;

Rigidbody rb;

float currSpeed = 0.0f;
float angle;

Vector2 input;

Transform cam;
Quaternion targetRotatiton;

private void Start()
{
rb = GetComponent<Rigidbody>();
cam = Camera.main.transform;
}

private void Update()
{
Debug.Log("currSpeed: " + currSpeed);
GetInput();
CalculateDirection();
{
Decceleration();
Move();
}else
{
Acceleration();
Move();
Rotate();
}
}

private void FixedUpdate()
{
if (Input.GetButtonDown("XboxA") && isGrounded)
{
Jump();
}
GroundCheck();
}

void GetInput()
{
input = new Vector2(Input.GetAxisRaw("XboxHorizontal"), Input.GetAxisRaw("XboxVertical"));
input = Vector2.zero;
else
}

void CalculateDirection()
{
angle = Mathf.Atan2(input.x, input.y);
angle += cam.eulerAngles.y;
}

void Move()
{
transform.position += transform.forward * currSpeed * Time.deltaTime;
}

void Rotate()
{
targetRotatiton = Quaternion.Euler(0, angle, 0);
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotatiton, rotateSpeed * Time.fixedDeltaTime);
}

void Jump()
{
rb.velocity = new Vector3(rb.velocity.x, jumpSpeed * 40, rb.velocity.z) * Time.fixedDeltaTime;
//rb.AddForce(Vector3.up * jumpSpeed * 40 * Time.deltaTime, ForceMode.Impulse);
}

void Acceleration()
{
currSpeed += accSpeed;
if (currSpeed >= moveSpeed)
currSpeed = moveSpeed;
}

void Decceleration()
{
if (isGrounded)
currSpeed -= deccSpeed;
else if (!isGrounded)
currSpeed -= airDeccSpeed;

if (currSpeed <= 0)
currSpeed = 0;
}

void GroundCheck()
{
if (Physics.Raycast(transform.position, Vector3.down, height, ground))
isGrounded = true;
else
isGrounded = false;
}
``````

}

Thanks for every idea how to fix it.

The video is unavailable