AddForce outside of FixedUpdate

Hey All!

I am fully aware that best practices call for one to AddForce in FixedUpdate, but I’m calling for a function mid animation that Add(s)Force to the player and therefore disregards FixedUpdate (Or Update) completely. Of course, AddForce does work, but the force (i’m guessing due to the timeframe) is inconsistent. The force seems to be the normal every 3 times the function is executed.

I plan on doing this with jump, strafe and perhaps some other animations so if someone could help me out, that’d be awesome. I went another route earlier with jump by lerping positions and avoiding AddForce completely, but that ends with me getting stuck in the terrain half the time (due to its unevenness). Changing velocity seems to keep me on the terrain.

Any ideas?

Coroutine? :smile: If you want it to be time dependant aka smooth?

I don’t really want it to be time dependent. It’s more or less dependent on the current frame of the jump (or strafe) animation. It’s through the Events system. (I probably should have stated that last time). The animation is activated by GetKeyDown so once the animation is finished the player can press the key again.

You know what, this is what pretty much fixed it.

rb.velocity = Vector3.zero;

I wasn’t aware I had to zero out the velocity. I do now though :stuck_out_tongue: