ToonTanks C++ Course - Tank isn't moving

Hey!

So as mentioned in the title, I wanted to change my MoveSpeed Variable from the BP Details Tab, I changed it and my tank isn’t moving anymore… I put it back to the old speed (203.0f) but I am still having the same problem…

I tried some stuff to figure out what is exactly causing the problem so I did these steps(But none of them helped):

1-I thought maybe it was the Start Delay variable, since the tank was supposed to move if its <= 0(Not sure about that), but when I logged the StartDelay variable out I found out that it wasn’t decreasing(Screenshot Included)

void ATankGameModeBase::BeginPlay() 
{
    Super::BeginPlay();
    
    GetWorld()->GetTimerManager().SetTimer(TestTimerHandle, this, 
    &ATankGameModeBase::TestLog, TestRate, true);
    HandleGameStart();
}

void ATankGameModeBase::TestLog() 
{
   UE_LOG(LogTemp, Error, TEXT("Start delay: %d"),StartDelay);
}

2-I also thought the MoveSpeed float variable isn’t working or something, so I tried changing it’s name from MoveSpeed to Movement Speed and recompiled the project but still didn’t work.


The CalculateMoveInput function:

void APawnTank::CalculateMoveInput(float Value) 
{
    float MoveAmount = (Value * MovementSpeed * GetWorld()->DeltaTimeSeconds);
    MoveDirection = FVector(MoveAmount, 0, 0);
    
}

3-Tried changing the MovementSpeed variable manually from the source code.

UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = "Components", meta = (AllowPrivateAccess = "true"))
	float MovementSpeed = 300.0f;

Forgot to mention that as well; The Tank’s fire functionality, animations, particles, sounds and rotations are working fine… The only problem is the movement.

Update: I can finally move my Tank now, How? Well, all I needed to do is lift it more up from the ground!

Idk what I’ve done wrong, but I remember duplicating the ground (to make the level bigger) maybe I messed something up while doing this… Here’s a screenshot of the min height I need to make the Tank movable:

Any ideas on what I’ve done wrong?

So your problem is resolved?

Oh yes, I solved it now!

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

Privacy & Terms