// move function
private void Move()
{
ApplyGravity();
GetDesiredMovementSpeed();
finalVector =
(groundVector * groundSpeed) +
(airVector * airSpeed) +
(Vector3.up * gravitySim);
if (jump.magnitude > characterSettings.jumpMagn)
{
finalVector += jump;
}
characterController.Move(finalVector * Time.deltaTime);
jump = Vector3.Lerp(jump, Vector3.zero, characterSettings.jumpDamp * Time.deltaTime); // heres where i lerp my jump
}
// where im processing player input / controlling momentum
private void ProcessPlayerInput()
{
horizontalInput = Input.GetAxisRaw("Horizontal");
verticalInput = Input.GetAxisRaw("Vertical");
if (characterController.isGrounded)
{
airVector = Vector3.zero;
if (isCrouching && isRunning)
{
isSliding = true;
groundVector.x = Mathf.Lerp(groundVector.x, 0, characterSettings.slideDamp * Time.deltaTime);
groundVector.z = Mathf.Lerp(groundVector.z, 0, characterSettings.slideDamp * Time.deltaTime);
if (Mathf.Abs(groundVector.x) < .175f && Mathf.Abs(groundVector.z) < .175f)
isRunning = false;
}
else
{
isSliding = false;
if (horizontalInput != 0 || verticalInput != 0)
{
groundVector = new Vector3(horizontalInput, 0, verticalInput);
groundVector.Normalize();
groundVector = transform.TransformDirection(groundVector);
}
else
groundVector = Vector3.Lerp(groundVector, Vector3.zero, characterSettings.groundDamp * Time.deltaTime);
}
}
else
{
Vector3 airControlVector = new Vector3(horizontalInput, 0, verticalInput);
airControlVector.Normalize();
airControlVector = transform.TransformDirection(airControlVector);
//im getting this kind of stuff while its still being created i think
airVector = Vector3.Lerp(airVector, airVector + airControlVector, characterSettings.airControlStrength * Time.deltaTime);
groundVector = Vector3.Lerp(groundVector, Vector3.zero, characterSettings.airDamp * Time.deltaTime);
}
}