Added acceleration to the movement
This commit is contained in:
parent
20063b408c
commit
4fa44a809a
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a382241647580d65fcb11eaed49b5c9e28ca99e8efd50ddb5f8f7c27bce6d1ae
|
||||
size 35058
|
||||
oid sha256:eae19cff0d1a7ec399f2bed7ddebeb12a0cd1464b7cc3aac8997e573ce9f340f
|
||||
size 35109
|
||||
|
||||
@ -153,19 +153,14 @@ void AZombieCharacter::MoveForwardConstant(float DeltaTime)
|
||||
{
|
||||
if (bStraight)
|
||||
{
|
||||
FVector vLocation = GetActorLocation();
|
||||
vLocation += GetActorForwardVector() * fBaseSpeed * DeltaTime;
|
||||
FVector vLocation = GetActorLocation();
|
||||
fBaseSpeed += fAcceleration * DeltaTime;
|
||||
vLocation += GetActorForwardVector() * fBaseSpeed;
|
||||
SetActorLocation(vLocation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
RotateCharacter();
|
||||
FVector vLocation = GetActorLocation();
|
||||
/*FVector forward = GetActorForwardVector();
|
||||
UE_LOG(LogTemp, Warning, TEXT("x: %.2f, y: %.2f, z: %.2f"), forward.X, forward.Y, forward.Z);*/
|
||||
vLocation += vCurrentDirection * 30.f * DeltaTime;
|
||||
SetActorLocation(vLocation);
|
||||
bStraight = true;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,9 @@ public:
|
||||
|
||||
// Base speed
|
||||
UPROPERTY(EditAnywhere, Category = "Movement")
|
||||
float fBaseSpeed = 100.f;
|
||||
float fBaseSpeed = 5.f;
|
||||
UPROPERTY(EditAnywhere, Category = "Movement")
|
||||
float fAcceleration = .001f;
|
||||
|
||||
void RotateCharacter();
|
||||
bool bStraight = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user