FActorSpawnParameters - how exactly does it work?

Hi !

I am trying to spawn projectile, and make ignore it’s owner, but i don’t quite know how to do it. Im trying to do something like this:

		FActorSpawnParameters params;
		params.Instigator = Controller->GetPawn();
		World->SpawnActor<AProjectileActor>(SpawnLocation, FireDirection, params);

And then in the projectile class, invoke IgnoreActorWhenMoving method.

	if (GetInstigator())
		m_CollisionCapsule->IgnoreActorWhenMoving(GetInstigator(), true);

But it doesn’t work at all. Could someone explain to me how does this FActorSpawnParameters work ? Is it passed to the spawned actor and can be used ? Or am i missing something ?

I don’t know if this helps, but if you want to set the collision handling when the object has been spawned (basically the green pin on the Spawn Actor from Class node), you need to set the handling method outside the GetWorld->SpawnActor() function separately.

So like :

AActor* SpawnedActor = GetWorld()->SpawnActor(<ClassReference>, <LocationOfSpawn>);
SpawnedActor->SpawnCollisionHandlingMethod = SpawnActorCollisionHandlingMethod::AlwaysSpawn; //This is basically the green "Collision Handling Override" pin

This might help
https://www.ue4community.wiki/Actor

Do you realise how old this question was? :smiley:

Really?