I am rather stumped on this bug and wanted to ask for some assistance and advice if anyone has dealt with this previously!
Backstory, I am developing a top down tactical looter shooter and have run into a problem when using Find Look At Rotation Function. For the basic aiming in my game i am using the hit results under cursor from the player Controller and the world location of the mesh component for the character.
Get Hit Result
I had also wanted to make a strafing ability when aiming. When strafing the pawn is facing towards the cursor hit result, and its movement direction is calculated from that rotation.
When the pawn is stationary and aiming, no matter the rotation there is no problem, but when strafing I have noticed that if the pawn is moving in a -X direction in world rotation, the pawns rotation starts to spaz out.
I thought it was possibly an animation issue, so I had disabled animations and tested, still the same issue. I tried converting the cursor hit result location to local, still same issue. My only theory as to a fix for this problem is to detach the upper torso of my skeleton and have it act as a “turret” that is attached to the body. Though I would prefer to not have to do that as I like using my blendspace to make the overall movement look natural and organic.
Does anyone have any suggestions or ideas to fix this? There does not seem to be many tutorials out there for top down games in UE5 that I have found unfortunately.
Below is the strafing yaw function for determining the aim offset for each direction the pawn is strafing in. (apologies, I know it is rather sloppy. I normally fix up functions once I know they work lol.)
Since the upper torso is blending to the lower body (base pose) when strafing the gun sways back and forth, which is preferable for realism. But, I theorize that the reason it is spazing is because it is contiously trying to rotate to/compensate. Is there a function that can transform a bone and not blend the ref pose? Ideally if i can remove the continous swaying motion during strafing I think that will fix the issue. But the only ways I can think of doing that is having two locomotion states maybe? Or separating the mesh by upper torso and lower body in the pawn BP.
Well on your Movement Input X is left and right and Y is for forward and back so if you want to strafe while aiming you would have to run a condition that checks if aiming then if so make it where you can move