이동 속도

This commit is contained in:
강민제 2025-04-24 01:56:23 +09:00
parent 49f2224f27
commit 71c2b2b028
3 changed files with 8 additions and 3 deletions

BIN
Content/Maps/Main.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -5,6 +5,7 @@
#include "Camera/CameraComponent.h" #include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h" #include "GameFramework/SpringArmComponent.h"
#include "Kismet/GameplayStatics.h"
ATank::ATank() ATank::ATank()
{ {
@ -24,6 +25,7 @@ void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
void ATank::Move(float Value) void ATank::Move(float Value)
{ {
FVector DeltaLocation = FVector::ZeroVector; FVector DeltaLocation = FVector::ZeroVector;
DeltaLocation.X = Value; float DeltaTime = UGameplayStatics::GetWorldDeltaSeconds(this);
DeltaLocation.X = Value * DeltaTime * Speed;
this->AddActorLocalOffset(DeltaLocation); this->AddActorLocalOffset(DeltaLocation);
} }

View File

@ -27,5 +27,8 @@ private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true")) UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
class UCameraComponent* Camera; class UCameraComponent* Camera;
UPROPERTY(EditAnywhere, Category = "Movement", BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
float Speed = 400.0f;
void Move(float Value); void Move(float Value);
}; };