Added the forwar constant movement

This commit is contained in:
JKuijperM 2022-12-27 16:14:56 +01:00
parent 4e5c92477a
commit 4a87eafbb6
4 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01a2ccb4fae05146826f110d944ac346e311548b5e59e5e8fe7477b6752d0862
size 33555
oid sha256:6707e0a03a08e3a1aa73dcdfd39c8839e283b0ca3e3e0119415a35d8dcb359dc
size 34084

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c79ba59dcd7112872785537bbae4dbf5908ee970011a5191b4524203ebb1fbc
size 354051
oid sha256:ee57909b9de0cae948caddc473536e0d62853e27ce154066e164b74edba3f39e
size 332032

View File

@ -68,6 +68,7 @@ void AZombieCharacter::BeginPlay()
void AZombieCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
MoveForwardConstant(DeltaTime);
}
@ -115,4 +116,12 @@ void AZombieCharacter::Move(const FInputActionValue& Value)
void AZombieCharacter::Crouch(const FInputActionValue& Value)
{
}
void AZombieCharacter::MoveForwardConstant(float DeltaTime)
{
FVector vLocation = GetActorLocation();
vLocation += GetActorForwardVector() * fBaseSpeed * DeltaTime;
SetActorLocation(vLocation);
}

View File

@ -63,4 +63,8 @@ public:
UPROPERTY(EditAnywhere, Category = "Movement")
float fBaseSpeed = 100.f;
private:
void MoveForwardConstant(float DeltaTime);
};