이동 속도
This commit is contained in:
parent
49f2224f27
commit
71c2b2b028
BIN
Content/Maps/Main.umap
(Stored with Git LFS)
BIN
Content/Maps/Main.umap
(Stored with Git LFS)
Binary file not shown.
@ -5,6 +5,7 @@
|
||||
|
||||
#include "Camera/CameraComponent.h"
|
||||
#include "GameFramework/SpringArmComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
ATank::ATank()
|
||||
{
|
||||
@ -24,6 +25,7 @@ void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||
void ATank::Move(float Value)
|
||||
{
|
||||
FVector DeltaLocation = FVector::ZeroVector;
|
||||
DeltaLocation.X = Value;
|
||||
float DeltaTime = UGameplayStatics::GetWorldDeltaSeconds(this);
|
||||
DeltaLocation.X = Value * DeltaTime * Speed;
|
||||
this->AddActorLocalOffset(DeltaLocation);
|
||||
}
|
@ -27,5 +27,8 @@ private:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
|
||||
class UCameraComponent* Camera;
|
||||
|
||||
UPROPERTY(EditAnywhere, Category = "Movement", BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
||||
float Speed = 400.0f;
|
||||
|
||||
void Move(float Value);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user