Made guns stay onto player but attach below the legs

This commit is contained in:
MH261677 2024-02-06 11:57:25 +00:00
parent f8aee1c58a
commit 64f17d7835

View File

@ -361,8 +361,9 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (IsValid(PrimaryWeapon))
{
PrimaryWeapon->DetachFromActor(DetatchRules);
PrimaryWeapon->SetActorLocation(FVector(0, 0, 0), false, nullptr, ETeleportType::None);
PrimaryWeapon->AttachToComponent(Mesh1P, AttachmentRules, FName("UnEquipGunSocket"));
PrimaryWeapon->SetActorHiddenInGame(true);
PrimaryWeapon->SetActorEnableCollision(false);
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
PrimaryWeapon = nullptr;
@ -414,9 +415,9 @@ void AEndlessVendettaCharacter::EquipSecondary()
if (bIsReloading) return;
if (IsValid(SecondaryWeapon))
{
SecondaryWeapon->DetachFromActor(DetatchRules);
SecondaryWeapon->SetActorLocation(FVector(0, 0, 0), false, nullptr, ETeleportType::None);
SecondaryWeapon->AttachToComponent(Mesh1P, AttachmentRules, FName("UnEquipGunSocket"));
SecondaryWeapon->SetActorHiddenInGame(true);
SecondaryWeapon->SetActorEnableCollision(false);
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
SecondaryWeapon = nullptr;