Update Weapon Pickup Defaults

This commit is contained in:
Louis Hobbs 2023-01-25 00:28:00 +00:00
parent ac9c8981b9
commit cb969be97c
2 changed files with 9 additions and 4 deletions

View File

@ -32,7 +32,9 @@ void AWeaponPickup::BeginPlay()
WeaponComponent->AttachToComponent(RootComponent, TransformRules);
WeaponComponent->SetActorRelativeLocation(FVector(0.0f, 0.0f, 5.0f));
WeaponComponent->SetActorEnableCollision(false);
WeaponStartingLocation = WeaponComponent->GetActorLocation();
WeaponStartingLocation += ((MovementDirection * MovementDistance) / 2);
SphereComponent->OnComponentBeginOverlap.AddDynamic(this, &AWeaponPickup::OnOverlapBegin);
}
@ -51,7 +53,7 @@ void AWeaponPickup::Tick(float DeltaTime)
// Bob weapon up and down
float Time = GetWorld()->GetRealTimeSeconds();
float Sine = FMath::Sin(Time * MovementSpeed);
WeaponComponent->SetActorLocation(WeaponStartingLocation + (MovementDirection * Sine));
WeaponComponent->SetActorLocation(WeaponStartingLocation + ((MovementDirection * Sine) * MovementDistance));
}
}

View File

@ -20,16 +20,19 @@ public:
TSubclassOf<class AWeapon> Weapon;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FVector MovementDirection = FVector(0.0f, 1.0f, 0.0f);
FVector MovementDirection = FVector(0.0f, 0.0f, 1.0f);
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float MovementDistance = 1.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float MovementSpeed = 1.0f;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FRotator SpinRotation = FRotator(0, 1, 0);
FRotator SpinRotation = FRotator(0.0, 1.0f, 0.0f);
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float RotationSpeed = 1.0f;
float RotationSpeed = 25.0f;
private: