95 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
98 return LastAppliedControl;
102 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
105 return LastAppliedAckermannControl;
110 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
111 FTransform GetVehicleTransform()
const
113 return GetActorTransform();
117 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
118 float GetVehicleForwardSpeed()
const;
121 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
122 FVector GetVehicleOrientation()
const;
125 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
126 int32 GetVehicleCurrentGear()
const;
129 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
130 FTransform GetVehicleBoundingBoxTransform()
const;
133 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
134 FVector GetVehicleBoundingBoxExtent()
const;
137 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
138 UBoxComponent *GetVehicleBoundingBox()
const
140 return VehicleBounds;
144 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
145 float GetMaximumSteerAngle()
const;
160 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
166 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
169 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
171 return AckermannController.GetSettings();
174 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
175 void RestoreVehiclePhysicsControl();
177 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
183 return AckermannController.ApplySettings(AckermannControllerSettings);
186 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
187 void SetSimulatePhysics(
bool enabled);
197 UFUNCTION(BlueprintNativeEvent)
198 bool IsTwoWheeledVehicle();
199 virtual
bool IsTwoWheeledVehicle_Implementation() {
210 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
213 if (bAckermannControlActive) {
214 AckermannController.Reset();
216 bAckermannControlActive =
false;
218 if (InputControl.Priority <= Priority)
220 InputControl.Control = Control;
221 InputControl.Priority = Priority;
225 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
228 bAckermannControlActive =
true;
229 LastAppliedAckermannControl = AckermannControl;
230 AckermannController.SetTargetPoint(AckermannControl);
235 return bAckermannControlActive;
238 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
239 void ActivateVelocityControl(
const FVector &Velocity);
241 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
242 void DeactivateVelocityControl();
244 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
247 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
248 void ShowDebugTelemetry(
bool Enabled);
251 void FlushVehicleControl();
260 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
261 void SetThrottleInput(
float Value);
263 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
264 void SetSteeringInput(
float Value);
266 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
267 void SetBrakeInput(
float Value);
269 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
270 void SetReverse(
bool Value);
272 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
275 SetReverse(!LastAppliedControl.bReverse);
278 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
279 void SetHandbrakeInput(
bool Value);
281 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
284 SetHandbrakeInput(
true);
287 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
288 void ReleaseHandbrake()
290 SetHandbrakeInput(
false);
293 TArray<float> GetWheelsFrictionScale();
295 void SetWheelsFrictionScale(TArray<float> &WheelsFrictionScale);
299 template<
typename T = UBaseCarlaMovementComponent>
302 return Cast<T>(BaseMovementComponent);
313 virtual void BeginPlay()
override;
314 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason);
316 UFUNCTION(BlueprintImplementableEvent)
319 UFUNCTION(BlueprintCallable, CallInEditor)
320 void AdjustVehicleBounds();
322 UPROPERTY(Category="Door Animation", EditAnywhere, BlueprintReadWrite)
323 TArray<FName> ConstraintComponentNames;
325 UPROPERTY(Category="Door Animation", EditAnywhere, BlueprintReadWrite)
326 float DoorOpenStrength = 100.0f;
328 UFUNCTION(BlueprintCallable, CallInEditor)
329 void ResetConstraints();
334 UPROPERTY(Category = "AI Controller", VisibleAnywhere)
337 UPROPERTY(Category = "CARLA Wheeled
Vehicle", EditAnywhere)
338 UVehicleVelocityControl* VelocityControl;
352 bool bAckermannControlActive =
false;
355 float RolloverBehaviorForce = 0.35;
356 int RolloverBehaviorTracker = 0;
357 float RolloverFlagTime = 5.0f;
362 UPROPERTY(Category =
"CARLA Wheeled Vehicle", EditDefaultsOnly)
363 float DetectionSize { 750.0f };
365 UPROPERTY(Category =
"CARLA Wheeled Vehicle", VisibleAnywhere, BlueprintReadOnly)
366 FBox FoliageBoundingBox;
368 UPROPERTY(Category = "CARLA Wheeled
Vehicle", EditAnywhere)
369 UBoxComponent *VehicleBounds;
372 FBox GetDetectionBox() const;
375 float GetDetectionSize() const;
378 void UpdateDetectionBox();
381 const TArray<int32> GetFoliageInstancesCloseToVehicle(const UInstancedStaticMeshComponent* Component) const;
383 UFUNCTION(BlueprintCallable)
384 void DrawFoliageBoundingBox() const;
387 FBoxSphereBounds GetBoxSphereBounds() const;
390 bool IsInVehicleRange(const FVector& Location) const;
395 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
398 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
401 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
404 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
407 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
410 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
413 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
414 void RecordDoorChange(const
EVehicleDoor DoorIdx, const
bool bIsOpen);
416 virtual FVector GetVelocity() const override;
419 UPROPERTY(Category="CARLA Wheeled
Vehicle", EditAnywhere)
420 float CarSimOriginOffset = 150.f;
423 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere)
424 bool bIsNWVehicle = false;
426 void SetRolloverFlag();
428 carla::rpc::VehicleFailureState GetFailureState() const;
430 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
431 static FRotator GetPhysicsConstraintAngle(UPhysicsConstraintComponent* Component);
432 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
433 static
void SetPhysicsConstraintAngle(
434 UPhysicsConstraintComponent*Component, const FRotator &NewAngle);
438 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere)
439 bool bPhysicsEnabled = true;
442 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
445 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
446 TArray<UPhysicsConstraintComponent*> ConstraintsComponents;
448 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
452 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
455 UPROPERTY(Category="CARLA Wheeled
Vehicle", VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
460 UFUNCTION(Category = "CARLA Wheeled
Vehicle", BlueprintCallable)
461 void ApplyRolloverBehavior();
463 void CheckRollover(const
float roll, const
std::pair<
float,
float> threshold_roll);
465 void AddReferenceToManager();
466 void RemoveReferenceToManager();
469 FTimerHandle TimerHandler;
471 float SpeedAnim { 0.0f };
472 float RotationAnim { 0.0f };
474 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
475 float GetSpeedAnim()
const {
return SpeedAnim; }
477 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
478 void SetSpeedAnim(
float Speed) { SpeedAnim = Speed; }
480 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
481 float GetRotationAnim()
const {
return RotationAnim; }
483 UFUNCTION(Category =
"CARLA Wheeled Vehicle", BlueprintCallable)
484 void SetRotationAnim(
float Rotation) { RotationAnim = Rotation; }