Hi,
I have been trying to have my character hold the gun at hip when a gun is being picked up. The pick-up mechanism along with many other features were implemented using C++ and I am not really familiar with Blue Print.
What I want to do is to change from this:
To this, once I pick up a weapon:
The codes for picking up weapon and firing:
void APlayerCharacter::Interact()
{
TArray<AActor*> Guns;
this->GetOverlappingActors(Guns);
for (int i = 0; i < Guns.Num(); i++)
{
AGun* const GunItems = Cast<AGun>(Guns[i]);
if (GunItems && !GunItems->IsPendingKill() && GunItems->GetActive() && GunItems->ActorHasTag("Pickable"))
{
GunItems->Interacted();
GunItems->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetIncludingScale, FName("HoldWeapon"));
bGun = true;
}
}
}
void APlayerCharacter::Shoot()
{
if (bGun == true)
{
Gun->Fire();
}
}
What might be some useful functions (c++ or blue print) that can be used in this case?
Thx!