Ive been trying to copy the accelerate function from quake but I have a problem. The acceleration is very inconsistent, what I mean by that is that it seems to depend on my framerate. When my fps is uncapped i accelerate way faster compared to when i cap my fps to 60.
I have no clue why this is the case, the function gets called in the tick function inside CharacterMovementComponent. But I do multiply the added speed with delta seconds so it shouldnt matter.
Assuming frameTime has the right value, the code seems correct. Have you tried to print the value of addSpeed when the game is running at 60fps against when it is running at 30fps? There should be a factor of two between the two values.
Ok, the values seem right (34 cm/s against 68 cm/s) Could you do the same but on a straight line (without changing direction)? At some point we should see addSpeed settling to 0 (when acceleration equals 0).
Ok, so according to your code it sould take around 0.43s to reach that speed (or 27frames @ 60fps and 13frames @ 30fps). Can you print addSpeed and GetCharacterMovement()->Velocity.Size() after line 7?
Tbh, I don’t see anything in your code that would explain your issue. That being said, I’m not sure it’s good practice to change the CharacterMovement’s velocity at each frame. I believe that what you’re trying to achieve would require to extend the CharacterMovementComponent class and override some base functions that handle the velocity in order to mimic Quake’s Character controller.