Projectile Movement Component?

Hi all,

I have set up the projectile movement component in the CPP file but there is no movement from the projectiles at all! Now before you say the missliles are colliding with the tank which they might well be doing the Projectile Movement Component is also not showing up in the Blueprint either. So I must have something wrong with my coding so here a two snippets involving the ProjectileMovementComponent, I need fresh eyes to take a look over to see what’s wrong:

Projectile.h

	UPROPERTY(VisibleAnywhere, Category="Combat", BluePrintReadWrite, meta = (AllowPrivateAccess = "true"))
		class UProjectileMovementComponent *pmc;

projectile.cpp

pmc = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Movement"));
	//These seem to be vars available in the ProJectileMovementComponent
	pmc->InitialSpeed = 10.0f;
	pmc->MaxSpeed = 15.0f;

Here is a piccy showing no info for the pmc, the Projectile Movement Component:

All help greatly appreciated.

Sorry guys, figured it out, I saved the BluePrint last night before adding the the changes in the CPP file earlier this morning and I needed to delete and redo the Blueprint for the changes to take effect. Hopefully deleting and then redoing the BluePrint with the same name won’t hurt the project as a whole :cold_sweat:.

Looks like it did stuff it up :pensive:. There are no projectiles showing up and in the Tank and Tower class where the projectile should show up with TSubClassOf there is now just: None.

I can’t think of anything to get the project working - I just don’t know enough about BluePrints to fix this!

Any help now, would be more than greatly appreciated.

Could you clarify what you mean by this? Do you mean it’s not there? It’s not selected? Or there’s nothing in the list when you click on it?

There is nothing in the list to change it to. The drop down selector is there,but it will not allow me to make a change and only has the word “NONE” in it. It’s very strange because the code is right.

Are you sure the property is set to EditAnywhere? That sounds like you have it as VisibleAnywhere.

I solved it thank goodness!

Just when I was about to throw it into the too hard basket and restart the project,like I said version control won’t work on my current computer, I had one last idea. That was to comment out all the lines relating to the Projectile Movement Component and the lines to the TSubclassOf, and compile the project. Then deleted the Blueprint and redid it again,making triply sure that it was correct.

Then I went and uncommented the code and compiled it and there it was spawning the projectiles, they were getting stuck at the spawn point on the tank :grin:. Had a good laugh about that, easy fix. But apart from the commenting, no code changes were needed.

“May you live in interesting times” :smiley:.

3 Likes

Glad you got there in the end :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms