feat: 加入摄像头旋转功能
This commit is contained in:
Binary file not shown.
BIN
Content/Inputs/IA/IA_CameraRotateAction.uasset
LFS
Normal file
BIN
Content/Inputs/IA/IA_CameraRotateAction.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -16,6 +16,9 @@ void ACameraPawn::CameraZoom(const FInputActionValue& Value)
|
||||
|
||||
void ACameraPawn::CameraRotate(const FInputActionValue& Value)
|
||||
{
|
||||
auto f = Value.Get<float>();
|
||||
FRotator r = FRotator(0.0f, f * 2.0f, 0.0f);
|
||||
AddActorWorldRotation(r);
|
||||
}
|
||||
|
||||
void ACameraPawn::CameraMove(const FInputActionValue& Value)
|
||||
|
||||
@@ -165,6 +165,10 @@ void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompone
|
||||
{
|
||||
EnhancedInputComponent->BindAction(CameraResetAction, ETriggerEvent::Triggered, this, &AMyCharacter::CameraReset);
|
||||
}
|
||||
if (CameraRotateAction)
|
||||
{
|
||||
EnhancedInputComponent->BindAction(CameraRotateAction, ETriggerEvent::Triggered, this, &AMyCharacter::CameraRotate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
class UInputAction* CameraZoomAction;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
|
||||
class UInputAction* CameraResetAction;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
|
||||
class UInputAction* CameraRotateAction;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Camera")
|
||||
class TSubclassOf<class ACameraPawn> CameraActorClass;
|
||||
|
||||
Reference in New Issue
Block a user