Fix static mesh inhabiting the incorrect position
This commit is contained in:
parent
e2e32e0092
commit
1b32434d98
|
@ -15,8 +15,7 @@ void AStaticMeshPickup::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
StaticMeshComponent->SetWorldLocation(this->GetActorLocation());
|
StartingLocation = StaticMeshComponent->GetRelativeLocation();
|
||||||
StartingLocation = this->GetActorLocation();
|
|
||||||
StaticMeshComponent->SetCollisionProfileName(FName("NoCollision"));
|
StaticMeshComponent->SetCollisionProfileName(FName("NoCollision"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,10 +25,10 @@ void AStaticMeshPickup::Tick(float DeltaTime)
|
||||||
|
|
||||||
if (StaticMeshComponent)
|
if (StaticMeshComponent)
|
||||||
{
|
{
|
||||||
// Rotate Weapon in desired direction
|
// Rotate StaticMesh in desired direction
|
||||||
StaticMeshComponent->AddLocalRotation((SpinRotation * RotationSpeed) * DeltaTime);
|
StaticMeshComponent->AddLocalRotation((SpinRotation * RotationSpeed) * DeltaTime);
|
||||||
|
|
||||||
// Bob weapon up and down
|
// Bob StaticMesh up and down
|
||||||
const float Time = GetWorld()->GetRealTimeSeconds();
|
const float Time = GetWorld()->GetRealTimeSeconds();
|
||||||
const float Sine = FMath::Abs(FMath::Sin(Time * MovementSpeed));
|
const float Sine = FMath::Abs(FMath::Sin(Time * MovementSpeed));
|
||||||
StaticMeshComponent->SetRelativeLocation(StartingLocation + ((MovementDirection * Sine) * MovementDistance));
|
StaticMeshComponent->SetRelativeLocation(StartingLocation + ((MovementDirection * Sine) * MovementDistance));
|
||||||
|
|
Loading…
Reference in New Issue