Smooth 360 analog rotation without snapping in place

i’m pulling my hair out with this. I’m simply trying to have a smooth rotation without snapping every 90 degrees

Our game cannot have this issue and i’m about to go back to my own engine I made due to this

i’m simply trying to rotate a 2D gun depending on the analog direction. I don’t want to to “move” to the analog position. I need it to be right were the analog is pointing.

EDIT: the twin stick shooter base project does the SAME thing with analog If anyone can make the twin stick shooter project smoother please let me know!

I have :

//FireForward / FireRight = x and y analog axis on right stick 

const FName ARedCobraPawn::FireForwardBinding("FireForward");
const FName ARedCobraPawn::FireRightBinding("FireRight");

const float FireForwardValue = GetInputAxisValue(FireForwardBinding);
const float FireRightValue = GetInputAxisValue(FireRightBinding);

const FVector LookDirection = FVector(FireForwardValue, FireRightValue, 0.0f);
const FRotator LookRotation = LookDirection.Rotation();

float rot = LookRotation.Yaw;

GunRSideMeshComponent->RelativeRotation.Yaw = rot;

this is the video showing the up / down / left / right snapping

Am I doomed or does someone actually have an answer for this ?


I’ll check tomorrow, but don’t think I had some snapping with my gamepad input. I’am using ps4 ds on win machine with ds4tool. What is your setup?

btw. maybe you should normalize your input before taking a rotation. just a guess.

This is just a debug test you can try. Just draw a debug line that scales with the length/rotation of your InputAxis. That said, your input is bound in a really odd way. Look in DefaultPawn.cpp to see how they do it there.

i’m somewhat of a newb … but how do you do that? T_T

I’m using an xbox controller on a win 8 PC

FireForwardValue (which is the raw analog numbers I would think) ect hangs onto the 0.0/ 1.0/ -1.0 ect longer than any other number / degree

I’m also using Gamepad Right Thumbstick Y-axis (1.0) for FireForward


I’m also using Gamepad Right Thumbstick X-axis (-1.0) for FireRight

You use this function:

I’d really look at DefaultPawn.cpp to get an idea of how they get/update their input there. You can search for this function “SetupPlayerInputComponent” and the functions they bind to.

thanks for the help, but I found the deadzone was at fault ,lowering it solved the issue ^ ^

I found that the deadzone variable was too high at default. lowering it solved the issue ^ ^

its’ under project settings → Engine/input ->Axis Config (show all advanced details checked on to see Axis Config)