Compare commits

..

2 Commits

Author SHA1 Message Date
baz
d07932771c Fix checks 2025-07-17 22:10:55 +01:00
baz
46f2d7b465 Fix weapon attachment issues 2025-07-17 22:10:38 +01:00
3 changed files with 9 additions and 7 deletions

View File

@ -41,10 +41,10 @@ void UWeaponInventoryComponent::AddWeaponToInventory(TSubclassOf<AWeapon> Weapon
FActorSpawnParameters SpawnParameters;
SpawnParameters.Owner = GetOwner();
AWeapon* weapon = GetWorld()->SpawnActor<AWeapon>(Weapon, GetOwner()->GetTransform(), SpawnParameters);
AWeapon* weapon = GetWorld()->SpawnActor<AWeapon>(Weapon, SpawnParameters.Owner->GetTransform(), SpawnParameters);
if (weapon->FollowPlayer)
{
weapon->AttachToActor(GetOwner(), FAttachmentTransformRules::KeepRelativeTransform);
weapon->AttachToActor(GetOwner(), FAttachmentTransformRules::KeepWorldTransform);
}
else
{

View File

@ -42,12 +42,14 @@ void ASwarmAgent::OnSwarmAgentBeginOverlap(UPrimitiveComponent* OverlappedCompon
if (!EnemyHealthComponent->GetIsDead())
{
if (AVampireCharacter* character = Cast<AVampireCharacter>(GetOwner()))
if (AWeapon* ownerWeapon = Cast<AWeapon>(GetOwner()))
{
if (AVampireCharacter* character = Cast<AVampireCharacter>(ownerWeapon->GetOwner()))
{
AController* ownerController = character->GetController();
AWeapon* ownerWeapon = Cast<AWeapon>(GetOwner());
EnemyHealthComponent->TakeDamage(Enemy, ownerWeapon->Damage, nullptr, ownerController, this);
}
}
}
}
}

View File

@ -52,7 +52,7 @@ void ASwarmWeapon::TimelineCallback(float val)
FVector Direction = FVector(0.0, 1, 0.0);
FVector RotatedDirection = Direction.RotateAngleAxis(val * 360.0f + offset, FVector(0.0f, 0.0f, 1.0f));
FVector NewLocation = CenterLocation + (RotatedDirection * Distance);
NewLocation.Z = 140.0f;
NewLocation.Z = 190.0f;
SwarmActors[i]->SetActorLocation(NewLocation);
}
}