修改摄像头的旋转逻辑
This commit is contained in:
parent
b783586e79
commit
d987f00373
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.patch_0.exp
Normal file
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish.patch_0.exp
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -30,7 +30,7 @@ AShipbase::AShipbase()
|
|||||||
//GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
|
//GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
|
||||||
//修改移动模式
|
//修改移动模式
|
||||||
GetCharacterMovement()->bOrientRotationToMovement = false; // Don't auto-orient to movement direction
|
GetCharacterMovement()->bOrientRotationToMovement = false; // Don't auto-orient to movement direction
|
||||||
GetCharacterMovement()->bUseControllerDesiredRotation = true; // Use controller rotation for turning
|
GetCharacterMovement()->bUseControllerDesiredRotation = false; // Use controller rotation for turning
|
||||||
|
|
||||||
GetCharacterMovement()->bUseSeparateBrakingFriction = true;
|
GetCharacterMovement()->bUseSeparateBrakingFriction = true;
|
||||||
GetCharacterMovement()->RotationRate = FRotator(0.0f, 500.0f, 0.0f); // ...at this rotation rate
|
GetCharacterMovement()->RotationRate = FRotator(0.0f, 500.0f, 0.0f); // ...at this rotation rate
|
||||||
@ -182,18 +182,17 @@ void AShipbase::Move(const FInputActionValue& Value)
|
|||||||
TurnRate *= -1.0f;
|
TurnRate *= -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply rotation to the character
|
// Apply rotation to the character only, not the controller
|
||||||
FRotator NewRotation = GetActorRotation();
|
FRotator NewRotation = GetActorRotation();
|
||||||
NewRotation.Yaw += TurnRate;
|
NewRotation.Yaw += TurnRate;
|
||||||
SetActorRotation(NewRotation);
|
SetActorRotation(NewRotation);
|
||||||
|
// // Also update controller rotation for camera
|
||||||
// Also update controller rotation for camera
|
// if (APlayerController* PC = Cast<APlayerController>(Controller))
|
||||||
if (APlayerController* PC = Cast<APlayerController>(Controller))
|
// {
|
||||||
{
|
// FRotator ControllerRotation = PC->GetControlRotation();
|
||||||
FRotator ControllerRotation = PC->GetControlRotation();
|
// ControllerRotation.Yaw += TurnRate;
|
||||||
ControllerRotation.Yaw += TurnRate;
|
// PC->SetControlRotation(ControllerRotation);
|
||||||
PC->SetControlRotation(ControllerRotation);
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user