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 ?
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’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.