CurrentRotation.Pitch = 90;
CurrentLocation.X = Floor.Location.X + 51;
SetActorRotation(CurrentRotation);
SetActorLocation(CurrentLocation);
FQuat Quat1 = GetActorQuat();
FQuat QuatZ(FVector(0,0,1), CurrentYaw*DeltaTime);
GEngine->AddOnScreenDebugMessage(0, 0.5, FColor::Cyan, FString::FormatAsNumber(Quat1.GetAxisX().X));
FQuat rot = Quat1*QuatZ;
NewRotation = rot.Rotator();
SetActorRotation(NewRotation);
GEngine->AddOnScreenDebugMessage(0, 0.5, FColor::Red, FString::FormatAsNumber(NewRotation.Yaw));
First I hard set pitch rotation to 90. And then position character to new floor location.
And here I try to to rotate character around axis:
FQuat QuatZ(FVector(0,0,1), CurrentYaw*DeltaTime);
And… I also tried to rotate about something to looks like proper axis (X)
FQuat QuatZ(FVector(1,0,0), CurrentYaw*DeltaTime);
And while in the second case there is no gimbal lock, character rotation is only in roll direction, while I want it to rotate in Yaw.
Any ideas, or pointer to explain what I’m doing wrong here ?