Custom Pawn Turn rate is too fast.
Alright, so I'm trying to make a pawn character that turns slower the faster you're going. For my control scheme I consider the direction the player inputs is the way they want to go, so say that you want to go southwest and the character is going north you would press the controls southwest and wait for your character to turn to match.
The problem: is that my pawn seems to be rotating WAY TOO FAST, to the point that it could just be doing random rotations and is practically a blur.
Here is the code that "throttles" the difference in direction to my max turning speed:
For clarity, TurningAmount is a FRotator set to represent the angle difference between the direction I want to go and the direction my pawn is currently going. It ranges for -180 to -180 with 0 being no difference in direction. I want it so my pawn rotates the fastest when the angle difference is a right angle or "90".
I haven't set up my turning speed value yet cause I wanted to get the code working on a normal level first. For now I've been representing that as the .0001. It was originally a 1 but I tried making it smaller thinking I had just set the code to rotate too fast.
OH, and I almost forgot: the code above is in my tick function and "should" be already controlled by delta seconds. I've been coding this in stages and it's worked perfectly until I added this rotation code.
Thank you for any and all help.
asked Mar 31 '19 at 04:56 AM in C++ Programming
Ok, I finally got fed up and just rewrote the code from scratch.
Basically I was forced to move my math out of the if/else statement and have that focus on just figuring out how much my controller is turning.
Hope someone learns from this, cause I'm not sure if I have...
answered Apr 06 '19 at 05:51 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here