UE C++ Course - ToonTanks - Camera and Projectile Movement Problem

First of all thanks for the amazing course, the course and the instructors are amazing!

So as shown in the screenshots, my first problem is the Projectile which spawns infront of the TurretMesh, when I fire it it doesn’t move forward, it stays where it spawned and drops on the ground.

My second problem is the Camera and the Camera Spring, So for some reason when I created the Camera Component when it was in it’s normal position(Behind the Tank), when I started the game the camera wasn’t behind the tank, it was way far on the right, so to fix it I had to move it in BP like in the screen shot…

Here is the Screenshots:

Here is some sections of the code which includes the Camera and the SpringArm:

PawnTank.h :

private:
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
	USpringArmComponent *SpringArm;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
	UCameraComponent *Camera;

PawnTank.cpp:

APawnTank::APawnTank() 
{
    SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("Spring Arm"));
    SpringArm->SetupAttachment(RootComponent);

    Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
    Camera->SetupAttachment(SpringArm);
    
}

I don’t know which code should I include for the Projectile Problem, but if know something about it you can ask me to include any sections of the codes here in the comments,

Thanks in advance!

For the projectile maybe it is the Projectile Spawn Point too close to the tank capsule?

Can you send a screenshot of the camera panel?
You can also try to create another Blueprint class derived from the same PawnTank class to see if the problem remain the same.

1 Like

Fixed the Projectile Problem!

The problem was as shown in the screenshot below, the InitialSpeed, MaxSpeed and InitialLifeSpawn of the ProjectileMovement Component was (for somereason) set to ‘0’ in Unreal, after I (manually) set them to 1300, 1300 and 0 it worked fine.

1 Like

Privacy & Terms