public virtual void Move() { float deltaTime = Time.fixedDeltaTime; Vector3 desiredMovement = movementInput * speed; if (grounded) { desiredMovement = Vector3.ProjectOnPlane(movementInput, groundNormal).normalized *desiredMovement.magnitude; } if (grounded && velocity.y <= 0) { velocity = Vector2.zero; Vector2 delta = groundPosition - collider.ClosestPoint(groundPosition); transform.position += (Vector3)delta; } else { velocity += Physics2D.gravity * deltaTime; } Vector3 movement; Vector3 finalVelocity; characterMovement.Move((velocity) * deltaTime, out finalVelocity); transform.position += finalVelocity; velocity = finalVelocity / deltaTime; characterMovement.Move(desiredMovement * deltaTime, out movement); transform.position += movement; }