Vaulting mechanism without losing speed / momentum
So I'm trying to make a parkour game where you can vault, but the thing is with my current code I can't vault without losing my speed, code : if (canLowVault && Input.GetKey(playerControllerSc.sprintKey)) { canLowVault = false; rb.isKinematic = true; RecordedMoveToPosition = lowVaultEndPoint.position; RecordedStartPosition = transform.position; }
if (parkourTime < 1f)
{
parkourTime += Time.deltaTime / parkourMoveTime;
rb.detectCollisions = false;
col.enabled = false;
rb.isKinematic = true;
transform.position = Vector3.Lerp(RecordedStartPosition, RecordedMoveToPosition, parkourTime);
if (parkourTime >= 1f)
{
rb.detectCollisions = true;
col.enabled = true;
rb.isKinematic = false;
parkourTime = 0f;
}
}
so, i need to make the Lerp speed to be as fast as my current speed or keep my speed before vaulting or is there a better way to vault??
Comment
Your answer
Follow this Question
Related Questions
Vertical Velocity for fps 0 Answers
i need a help with script Animation Trigger 1 Answer
LookRotation with constant speed 0 Answers
C# FPS Speed Boost 0 Answers
Help with drift physics 0 Answers