I have implemented a “roll” input action for my third-person character. When pressed, she should perform a roll animation and get launched in the direction the player is inputting with velocity determined by some scalar value.
I have tried various setups for this so far, but none of my guesswork seems to be working quite right. The closest I’ve gotten is the setup below, making a vector out of the “Move Forward” and “Move Right” axis values, setting rotation based on that, and then adding an impulse from the forward vector, like so:
This setup almost works perfectly, but with one issue. If I rotate my camera 180 degrees about the X axis, all of the impulses seemingly become reversed. In other words, after spawning, if I hold forward (W) and press roll, I roll forward. If I face the character towards the camera and hold backwards (S), she rolls towards the camera, as expected. But if after spawning I were to rotate the camera 180 degrees about the X axis (so now I am looking at the character’s front), press (W) so she faces forward, and then press roll + (W), she is not launched forwards, but backwards, and vice versa. So it seems to change depending on which direction the character is facing in the world, rather than just which inputs I’m pressing.
Does anyone know how I can remedy this or what I am missing? I hope I explained well enough, please let me know if clarification is needed.