so I'm trying to write a character control semi similar to taitan fall 2's and apex legends
where you gain velocity from different things (like an exploding grenade or something) while also having the velocity you add via inputs (wasd)
basically what I'm am trying to achieve is something like
private void FixedUpdate(){
rb.velocity += input;
}
obviously the problem with the code above is if you keep holding forward key for n frames, your velocity will become n time the speed limit
one fix (which didn't work) that I came up with was
private void FixedUpdate(){
rb.velocity -= input_from_last_frame
rb.velocity += input;
}
but this doesn't work either cuz if between the last frame and the current frame you hit a wall, your velocity will become zero and by removing the input_from_last_frame your velocity will become negative which isn't ideal
to sum it all up, what I need is for the velocity that is gained by thing like idk a genrade exploding near the player be calculated sproatley so that at the end I can add the velocity gained form the players input without effecting the velocity gained from the environment and how that is calculated
if that makes any sense 