I am trying to make a system where when I press the sprint key, instead of instantly going to my sprint speed, it would gradually go from walk speed to sprint and crouch and prone would do the same but with the added height change.
I already tried using timelines and it worked perfectly until I went from sprinting to crouching where when I try to crouch it first stops the sprint which reverses the sprint timeline and right after plays the crouch timeline but as the stop sprint is little bit longer than crouching the final character speed instead of being the crouched speed would be the walking speed (when the sprint timeline reverses it goes to the walking speed) because the stop sprint ends after the crouching.
I imagine I could just tweak the times so they finish when they should but I am almost certain that thereâs a better way to do that and also I donât plan on using animations for now.
The problem is that when I sprint the max speed only goes up to â505.XXXXXâ instead of 850 and if I set the interp speed to 10 then i goes to â55X.XXXXâ.
I also tried Interp to constant and it did not work.
The system I used to have was using a Lerp and timeline and only had problems when the timelines overlap. Is there someway to make a function wait for a timeline to end?
Edit: And also if it is possible not to use the tick function? I am a big noob and I learned/heard that using Tick is a bad practice
In your CPP example, the âcurrent max speedâ needs to read from the character, every tick
( it needs to be a live sample ).
PS: To be clear, thereâs no rule about reading it from the character, but it does need to be the actual current max speed. How you do that is up to you, but it will basically mean setting the speed on the character every tick and either reading it again, or reading it from a variable youâre using to set the speed.