Hello there,
I am trying to create handling for spaceship pawn, But got stuck in axis constrains in Roll and Pitch axis.
I tried AddControllerYawInput(), AddControllerPitchInput(), GetController()->SetControlRotation() etc…
Method for roll rotation:
void AMyPawn::RotateRightHorizontal(float Amount)
{
FRotator actorRotation = GetControlRotation();
FQuat rotationDelta = FQuat::MakeFromEuler(FVector(Amount, 0.f, 0.f));
FQuat newRotation = actorRotation.Quaternion() * FQuat::MakeFromEuler(FVector(Amount, 0.f, 0.f));
newRotation.Normalize();
GetController()->SetControlRotation(newRotation.Rotator()); // works only in angle 90 to -90
GetController()->AddActorLocalRotation(rotationDelta); // pruduce error
//AddControllerRollInput(Amount); // works only in angle 90 to -90
}
All this seems to be stuck on -90, 90 constrains. Why is that? What is blocking it? Is it because this methods updates my actor in world space?
I also tried GetController()->AddActorLocalRotation() but this produce an error:
Error (active) E0265 function "AController::AddActorLocalRotation(const FQuat &DeltaRotation, bool bSweep = false, FHitResult *OutSweepHitResult = (FHitResult *)nullptr, ETeleportType Teleport = ETeleportType::None)" (declared at line 390 of "D:\Epic Games\games\UE_4.24\Engine\Source\Runtime\Engine\Classes\GameFramework\Controller.h") is inaccessible MyProject D:\myWork\PixelArtGame\MyProject\Source\MyProject\MyPawn.cpp 92
Am I getting something wrong or what is going on? Or how to achieve rotation “freedom” in all axis?
Thanks for answers.