hi developers, i have a serious problem with tank’s sideway movement and i can not figure it out.
the problem is Ben did set “CurrentThrottle” at SetThrottle function like this:
void UTrack::setThrottle(float throttle) {///called from blueprint
//UE_LOG(LogTemp, Warning, TEXT("throttle is %f"), throttle)
currentThrottle = FMath::Clamp<float>(throttle + currentThrottle, -1, 1);
//currentThrottle = throttle;
}
i really cant understand the reason of setting “CurrentThrottle” like that.(if anyone know that please share the reason with me)
and the other problem is i tried to set “CurrentThrottle” like the way we did before.
currentThrottle = throttle;
the result was Tank never moved sideway at all(but with setting throttle like how Ben did it works perfectly)
and the other thing about this behavior that makes me wonder is i tried to log the “CurrentThrottle” at “Driving” function and again the result for moving forward is predictable(-1, +1 , 0) but its always 0.000 for moving right.
as i understand when i press “Right/Left” button first things first Blueprints set the controller for keyboard and then we use it to modify IntendToMoveForward/Right like this:
so when we use the result in C++ function of IntendToMoveRight it should be alright(and it is).
but why when “Driving” function calls from OnHit(…) function CurrentThrottle is always 0 for side ways movement and its alright for forward movement?
thank you.