fixed bug not getting max steering when applying commands

This commit is contained in:
Joel Moriana 2022-02-08 11:57:51 +01:00 committed by joel-mb
parent 04ea5f4e55
commit a96c5bbdf5
2 changed files with 9 additions and 6 deletions

View File

@ -124,16 +124,16 @@ void FAckermannController::RunControlReverse() {
// Change of driving direction to forward.
bReverse = false;
}
}
} else {
if (FMath::Sign(VehicleSpeed) * FMath::Sign(UserTargetPoint.Speed) == -1) {
// Requested for change of driving direction.
// First we have to come to full stop before changing driving direction
UE_LOG(LogCarla, Log, TEXT("Requested change of driving direction. First going to full stop"));
TargetSpeed = 0.0;
}
}
}
void FAckermannController::RunControlSpeed() {
SpeedController.SetTargetPoint(TargetSpeed);
SpeedControlAccelDelta = SpeedController.Run(VehicleSpeed, DeltaTime);

View File

@ -193,6 +193,9 @@ void ACarlaWheeledVehicle::BeginPlay()
MovementComponent->WheelSetups = NewWheelSetups;
LastPhysicsControl = GetVehiclePhysicsControl();
// Update physics in the Ackermann Controller
AckermannController.UpdateVehiclePhysics(this);
}
}