Hello,
So I followed the lecture and built the turning mechanism for the tank with the added modification to make it keyboard only:
void UTankMovementComponent::MoveForward(float inputThrow)
{
UE_LOG(LogTemp, Warning, TEXT("Forward throttle: %f"), inputThrow);
leftTrack->SetThrottle(inputThrow);
rightTrack->SetThrottle(inputThrow);
}
void UTankMovementComponent::MoveBackward(float inputThrow)
{
UE_LOG(LogTemp, Warning, TEXT("Backward throttle: %f"), inputThrow);
leftTrack->SetThrottle(-inputThrow);
rightTrack->SetThrottle(-inputThrow);
}
void UTankMovementComponent::TurnLeft(float inputThrow)
{
UE_LOG(LogTemp, Warning, TEXT("Left throttle: %f, %f"), -inputThrow, inputThrow);
leftTrack->SetThrottle(-inputThrow);
rightTrack->SetThrottle(inputThrow);
}
void UTankMovementComponent::TurnRight(float inputThrow)
{
UE_LOG(LogTemp, Warning, TEXT("Right throttle: %f, %f"), inputThrow, -inputThrow);
leftTrack->SetThrottle(inputThrow);
rightTrack->SetThrottle(-inputThrow);
}
I have noticed that when I try to turn right or left the log acknowledges the intend to turn, but remains motionless, unless the tank is in the air, falling or floating when it does make a difference and it does turn.
Any help is greatly appreciated!
EDIT: It does go forwards and backwards as intended. I’m on version 4.15.2.