Dispite efforts, I can't get my projectile movement component to work.


I have been trying to get my projectile to work for days now. For some reason, despite me following the exact same steps I did whenever I first took the GameDev.tv class. To break down what I have:


This is the constructor I have for my projectile. It’s derived from C++. You’ll find the code from the constructor below.

	PrimaryActorTick.bCanEverTick = false;

	RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Projecile Root Component"));

	CollisionMesh = CreateDefaultSubobject<UBoxComponent>(TEXT("Collision"));

	ShotMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Shot Mesh"));

	ProjectileMovementComp = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile Movement Component"));
	ProjectileMovementComp->InitialSpeed = 3000;
	ProjectileMovementComp->MaxSpeed = 3000;
	ProjectileMovementComp->ProjectileGravityScale = 0;
	ProjectileMovementComp->bRotationFollowsVelocity = true;

For the sake of debugging, I’ve set the static mesh and the collision box to ignore all channels, in case it happened to be hitting something when spawned.

As for the firing function:

void ABasePawn::Fire(TSubclassOf<class AProjectile> Projectile)
	if (PrimaryProjectileGauge >= 1)
		FActorSpawnParameters SpawnParameters;
		SpawnParameters.Owner = this;
		SpawnParameters.Instigator = this;

		AProjectile* FiredProjectile = GetWorld()->SpawnActor<AProjectile>(
		PrimaryProjectileGauge -= 1;

The spawn point derives from a component that is part of ABasePawn. I’ve made sure that the projectile isn’t immediately colliding with the mesh of the pawn by moving it a sizeable distance away from the pawn. Alas, I don’t think that’d make a difference, since I already disabled all of the collision.

Finally, I made sure that the collision mesh and the static mesh were set to ‘Moveable’, and that the projectile movement component was set to ‘Auto Activate’.

Here’s the result:


Any help is much appreciated.