Ignoring player collision with its projectile collision.

Hello !

I want to spawn projectile when player is shooting, to ignore each others collision. But everytime i try to set an owner in FActorSpawnParameters, it doesn’t work or i have no clue how to work with it.

In Player Class:

		FActorSpawnParameters SpawnInfo;
		SpawnInfo.Owner = this;
		GetWorld()->SpawnActor<AProjectileActor>(SpawnLocation, FireDirection, SpawnInfo);

And in Projectile Class:

	if (GetOwner())
		UE_LOG(LogTemp, Warning, TEXT("Projectile Owner: %s"), *GetOwner()->GetFName().ToString());
		m_CollisionCapsule->IgnoreActorWhenMoving(GetOwner(), true);

Could anyone explain, how does it work or show some kind of workaround ? It would help alot :slight_smile:

Best Regards.

I use the method similar to what is found in the ShooterGame Example:

void AShooterWeapon_Projectile::ServerFireProjectile_Implementation(FVector Origin, FVector_NetQuantizeNormal ShootDir)
    FTransform SpawnTM(ShootDir.Rotation(), Origin);
    AShooterProjectile* Projectile = Cast<AShooterProjectile>(UGameplayStatics::BeginSpawningActorFromClass(this, ProjectileConfig.ProjectileClass, SpawnTM));
    if (Projectile)
        Projectile->Instigator = Instigator;

        UGameplayStatics::FinishSpawningActor(Projectile, SpawnTM);

You can take it further by forcing components of the player to ignore the bullet too:

    if (UPrimitiveComponent* PrimitiveComp = Cast<UPrimitiveComponent>(GetOwner()->GetRootComponent()))