Would I have to write code inside of the gun actor itself?
I have used the First Person Camera Component but now I have a gun skeletal mesh with a muzzle socket how would I attach the line trace to the muzzle of the the skeletal mesh? Should I attach a line trace to the muzzle. Is there another more effective option. Am I close or far?
void UE4Character::Linetrace()
{
FHitResult* HitResult = new FHitResult();
FHitResult Hit;
const float BulletDistance = 20000.0f;
FVector CameraForward = FVector(FP_Gun->GetForwardVector());
const FVector StartTrace = FP_Gun->GetSocketLocation("Muzzle");
const FVector EndTrace = (FP_Gun->GetForwardVector() * BulletDistance);
FCollisionQueryParams QueryParams = FCollisionQueryParams(SCENE_QUERY_STAT(WeaponTrace),
false, this);
FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
}