Hello, a bug came up in my project that came out of nowhere and I am having trouble fixing because I have no idea what might be causing it. Here’s the issue in this .gif:
Basically, when I move up, it’ll pull in random directions. Same when the character is falling. I tried different keyboards, but I still get the same issue.
I even tried moving around in minimal default, which had no problems before, now I am having the same issue.
Here is the character movement code:
void APlayerCharController::MoveRight(float Delta)
{
APlayerCharacter* const PlayerRef = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (Delta != 0.0f && PlayerRef->CanAct())
{
// find out which way is right
const FRotator Rotation = GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get right vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
PlayerRef->AddMovementInput(Direction, Delta);
}
}
void APlayerCharController::MoveForward(float Delta)
{
APlayerCharacter* const PlayerRef = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
if (Delta != 0.0f && PlayerRef->CanAct())
{
// find out which way is forward
const FRotator Rotation = GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
PlayerRef->AddMovementInput(Direction, Delta);
}
}
Any idea what might be causing this issue, or if there is some setting I may have accidentally checked that causes something like this? Any help would be appreciated.