Collision Presets: Projectile

I’m trying to create a simple projectile for my side scrolling shooter.

I’ve taken a look at how it’s done with the First Person C++ template, and it seems simple enough:

Add the projectile.cpp and .h classes, then create a projectile

I have my firing input set to left-mouse button, and I can see it being called when I set a breakpoint. However, projectile always returns null, so it skips over the function.

    void AFlyingPawn::OnFire()
        {
        	// try and fire a pr 
ojectile
    	if (ProjectileClass != NULL)
    	{
    		// Get the camera transform
    		FVector CameraLoc;
    		FRotator CameraRot;
    		GetActorEyesViewPoint(CameraLoc, CameraRot);
    
    		// MuzzleOffset is in camera space, so transform it to world space before offsetting from the camera to find the final muzzle position
    		FVector const MuzzleLocation = CameraLoc + FTransform(CameraRot).TransformVector(MuzzleOffset);
    		FRotator MuzzleRotation = CameraRot;
    		MuzzleRotation.Pitch += 10.0f;			// skew the aim upwards a bit
    
    		UWorld* const World = GetWorld();
    		if (World)
    		{
    			FActorSpawnParameters SpawnParams;
    			SpawnParams.Owner = this;
    			SpawnParams.Instigator = Instigator;
    
    			// spawn the projectile at the muzzle
    			AFirstpersonProjectile* const Projectile = World->SpawnActor(ProjectileClass, MuzzleLocation, MuzzleRotation, SpawnParams);
    			if (Projectile)
    			{
    				// find launch direction
    				FVector const LaunchDir = MuzzleRotation.Vector();
    				Projectile->InitVelocity(LaunchDir);
    			}
    		}
    	}
    }

I also have the projectile class referenced in my FlyingPawn.h

/** Projectile class to spawn */
UPROPERTY(EditDefaultsOnly, Category=Projectile)
TSubclassOf ProjectileClass;

I’ve created a projectile blueprint which is identical to the one seen in the First Person template, but they is one thing I can’t seem to find: Collision Preset: Projectile

In the First Person Template, the blueprint has the option to set the collision as Projectile. (this is found just beneath Vehicle).

In my game, I don’t see an option for projectile, which leads me to believe that I am doing something wrong.

1) Why is my projectile always returning null
2) Where do I find this collision preset for projectile?

There were a number of issues that I had with the projectile, but the resolution for the collision problem can be found in this thread here:

Constructing a projectile

I’ve answered my 2nd question:

In DefaultEngine.ini, you need to add the following:

[/Script/Engine.CollisionProfile]

; customized game channel
; if you do this, make sure you define in native for convenience
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1, Name=Projectile)

+Profiles=(Name="Projectile", CollisionEnabled=QueryOnly,ObjectTypeName=Projectile, CustomResponses=( \
(Channel=Static,			Response=ECR_Overlap), \
(Channel=PawnMovement,		Response=ECR_Overlap), \
(Channel=Dynamic,			Response=ECR_Overlap), \
(Channel=PhysicsBody,		Response=ECR_Overlap), \
(Channel=VehicleMovement,	Response=ECR_Overlap), \
(Channel=Destructible,		Response=ECR_Overlap)  \
))

But I’m still returning null for my projectile. Odd.

CollisionEnabled=QueryOnly ==>> CollisionEnabled=2

0 = No Collision
1 = No Physics Collision
2 = Collision Enabled

QueryOnly = 0