Collision settings are not consistent (and crash!)

I have a Projectile C++ class.
I made a Blueprint class deriving from it in order to make my Rocket actor.

FIRST PROBLEM (StaticMesh)

The Rocket has a StaticMesh component and a SphereCollision component. The latter is supposed to detect collision with a Player

108008-crocket2.jpg

I wanted my StaticMesh not to collide with any player (thus, Pawn) inside the World, so I set the StaticMesh collision settings to this:

108009-crocket.jpg

Note the Pawn that is set to be Ignored

When I put the Blueprint inside the World, these options work.
When I fire my Rocket through the Weapon, they don’t! The StaticMesh still blocks my Player!

One can say that the problem lies right in the fact that I’m spawning something through C++ code… BUT it shouldn’t change my collision settings!

This is the code I use to spawn a projectile

FTransform SpawnTM(MyOwner->GetMesh()->GetSocketLocation((FName("WeaponSocket"))));	

	AProjectile* Projectile = Cast<AProjectile>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, ProjectileClass, SpawnTM));
	
	if (Projectile)
	{		

		Projectile->Instigator = Instigator;
		Projectile->SetOwner(this);
		Projectile->InitVelocity(ShootDir);

		UGameplayStatics::FinishSpawningActor(Projectile, SpawnTM);
	}

SECOND PROBLEM (SphereCollision + Event)

My Projectile class has a OnProjectileStop delegate, which is called whenever the ShereCollision component is blocked by someone

It works fine when I shoot the Rocket through the weapon.
But when I put the Blueprint of the Rocket inside the World and run towards the SphereCollision, the Engine crashes with a fatal error!

Log file of the crash: [link text][3]

Hey gedamial,

When you’re spawning your projectile, are you spawning the base C++ class or are you ensuring to spawn a reference to your blueprint? The changes in collision that you’ve made are only relevant to the blueprint class and if you are spawning the C++ class, those changes won’t be carried over.

When you’re spawning your projectile, are you spawning the base C++ class or are you ensuring to spawn a reference to your blueprint?

The Weapon (rocket launcher) is responsible for the spawn of the associated projectile (in this case, a rocket).

Weapon is another C++ class which holds a variable of type TSubclassOf

This variable holds a class.
This variable is set through the Editor.

Since my Rocket is a Blueprint Class (which derives from AProjectile c++ class) I can easily set that variable to my Rocket Blueprint Class.

So… in short… yes, I’m referring to the Blueprint Class

You are changing the settings of the collision sphere of the projectile, but you forgot about the collision of the rocket mesh itself (which you can disable completely

I would try to make a new Object Collision Channel for the Rockets, and set that this channel is Ignored on Default. This way the Pawn will also ignore your rocket and vice versa.

He said that he changed the StaticMesh which is the body of the rocket. The sphere is there just for overlap detection.

Or you could give your rocket a Projectile Movement component, or set CCD (Continuous Collision Detection) to true and just let the rocket collide with the player.

You are right, sry missed that, but still he doesn’t need any collision on the mesh since it’s going to be destroyed on impact, so why turn it off completely?
And on sphere collision overlapr, he can cast the overlaping object to check if it’s a pawn or not

But it also have to explode if it hits a wall, or something else. Then why not use only the Static Mesh for hit detection and check what it is? Well, I’d think that if the players run forward and shoots at the same time, it could easily “backfire”. Or the rocket comes out from the character mesh itself.

No, like I said on overlap, cast the overlapped object to pawn, if it is not a pawn then explore. However if you only want to ignore the player, that’s easy, just add to your projectile construction script “Ignore Instigator”, and don’t forget to connect the player “Self” Node to the Spawn Projectile node

I once had a strange bug where if the mesh was the main component was a scene root component the projectile would not work. You can try to have The mesh as the main component. Or maybe it was the other way around (make the main component a scene root component). Just try it, it may or may not work

The Rocket’s StaticMesh must be set to Ignore all the Pawns in the game (and that’s what I did, but it doesn’t work!)

What does your Rocket blueprint’s component tree look like? Could you provide a screenshot of that please?

![alt text][1]

It doesn’t ignore pawn now. It’s that intentional?

Glad to hear that I gave a staff approved advice :smiley:

Thanks a lot. Those settings look solid to me. One more question: if your static mesh is set to ignore your pawn, is your pawn also set to ignore the static mesh component of the rocket, which is currently set to WorldDynamic based on your screenshot provided earlier in the thread?

I’d recommend creating a separate object channel as well for the Rocket static mesh if possible.

Hi.

I created a new Object Channel (default response: ignore) and applied that to my Rocket Static Mesh

And this is the Pawn Capsule Collision setting

As you can see, both ignore each other… but it doesn’t work :c

But the CollisionComp still Blocks the Pawn channel, doesn’t it?

The Collision Component of the Rocket MUST block the Pawn (for hit detection). It’s the StaticMesh that MUST NOT block the Pawn.