From d5a469314ef7c51705ce8715506047174fbdea17 Mon Sep 17 00:00:00 2001 From: meishibiezb <750783119@qq.com> Date: Sun, 15 Mar 2026 22:34:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=85=A5=E6=91=84=E5=83=8F?= =?UTF-8?q?=E5=A4=B4=E6=97=8B=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content/Blueprints/BP_TestChar.uasset | 4 ++-- Content/Inputs/IA/IA_CameraRotateAction.uasset | 3 +++ Content/Inputs/IMC/IMC_Context.uasset | 4 ++-- Source/lonese/CameraPawn.cpp | 3 +++ Source/lonese/MyCharacter.cpp | 4 ++++ Source/lonese/MyCharacter.h | 2 ++ 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 Content/Inputs/IA/IA_CameraRotateAction.uasset diff --git a/Content/Blueprints/BP_TestChar.uasset b/Content/Blueprints/BP_TestChar.uasset index 5394a40..81a91fb 100644 --- a/Content/Blueprints/BP_TestChar.uasset +++ b/Content/Blueprints/BP_TestChar.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ab7d4c80512e5a429f683b0d634b583f773e2dc13323d994aa5926546bc86be2 -size 35856 +oid sha256:06d7c7e081e57763f56373431a406553c46083c7b778f58fb71f6fbd9dc86ce6 +size 36123 diff --git a/Content/Inputs/IA/IA_CameraRotateAction.uasset b/Content/Inputs/IA/IA_CameraRotateAction.uasset new file mode 100644 index 0000000..cc6ee67 --- /dev/null +++ b/Content/Inputs/IA/IA_CameraRotateAction.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:637ee74171478765d6a85ea16d0e041980afb867dc139ff79847b16ce4995c73 +size 1212 diff --git a/Content/Inputs/IMC/IMC_Context.uasset b/Content/Inputs/IMC/IMC_Context.uasset index b98783e..cbb6cf2 100644 --- a/Content/Inputs/IMC/IMC_Context.uasset +++ b/Content/Inputs/IMC/IMC_Context.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7ef8f106233c3145223035eedca1342073d242f3fd6d6bebf9d6cf919d4f11da -size 9108 +oid sha256:185d3d5ea8d60f08f919003d85e587d15685d4d85732d9ccab8bd9bb082ee55b +size 10031 diff --git a/Source/lonese/CameraPawn.cpp b/Source/lonese/CameraPawn.cpp index 9b49c80..123bf18 100644 --- a/Source/lonese/CameraPawn.cpp +++ b/Source/lonese/CameraPawn.cpp @@ -16,6 +16,9 @@ void ACameraPawn::CameraZoom(const FInputActionValue& Value) void ACameraPawn::CameraRotate(const FInputActionValue& Value) { + auto f = Value.Get(); + FRotator r = FRotator(0.0f, f * 2.0f, 0.0f); + AddActorWorldRotation(r); } void ACameraPawn::CameraMove(const FInputActionValue& Value) diff --git a/Source/lonese/MyCharacter.cpp b/Source/lonese/MyCharacter.cpp index 0684b96..4296992 100644 --- a/Source/lonese/MyCharacter.cpp +++ b/Source/lonese/MyCharacter.cpp @@ -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); + } } } diff --git a/Source/lonese/MyCharacter.h b/Source/lonese/MyCharacter.h index fb0c4c2..272f25e 100644 --- a/Source/lonese/MyCharacter.h +++ b/Source/lonese/MyCharacter.h @@ -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 CameraActorClass;