Real basic lerp that I just applied to act as acceleration for my player controller is launching the player instantly out of bounds.
worked perfectly fine before adding the lerp.
And I have the acceleration set to 0.5 and 0.1
Doesn’t fly off when its a whole number, strangely.
private void UpdateMovement()
{
movementInput = movement.action.ReadValue<Vector2>();
if (isGrounded) movementHeading = Vector2.Lerp(movementHeading, movementInput, groundAcceleration);
if (!isGrounded) movementHeading = Vector2.Lerp(movementHeading, movementInput, airAcceleration);
movementHeading *= movementSpeed;
movementHeading.y = 0;
if (movementHeading.x > 0)
{
if (!isFacingRight) transform.rotation = Quaternion.Euler(0, 0, 0);
isFacingRight = true;
}
if (movementHeading.x < 0)
{
if (isFacingRight) transform.rotation = Quaternion.Euler(0, 180, 0);
isFacingRight = false;
}
}
private void ApplyMovement()
{
Vector3 appliedMovement = new Vector3(movementHeading.x, movementHeading.y, 0);
appliedMovement *= Time.fixedDeltaTime;
if (isGrounded) appliedMovement += hit.point;
if (!isGrounded) appliedMovement += transform.position;
myRigidbody.MovePosition(appliedMovement);
}
Thanks in advanced.