CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Vehicle
CarlaVehicleAnimationInstance.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <util/ue-header-guard-begin.h>
10
#include "VehicleAnimationInstance.h"
11
#include <util/ue-header-guard-end.h>
12
13
#include "CarlaVehicleAnimationInstance.generated.h"
14
15
class
ACarlaWheeledVehicle
;
16
17
/// Parent class of the vehicle animation blueprints. Draws the vehicle's
18
/// overridden wheel poses, and otherwise, while Chaos is not simulating the
19
/// vehicle, which is when the engine leaves the wheels frozen, rolls them by
20
/// the distance they travel.
21
UCLASS(transient)
22
class CARLA_API
UCarlaVehicleAnimationInstance
: public
UVehicleAnimationInstance
23
{
24
GENERATED_BODY()
25
26
public
:
27
28
virtual
void
NativeUpdateAnimation
(
float
DeltaSeconds)
override
;
29
30
/// The pose last written for a wheel, or nullptr if there is no such wheel.
31
const
FWheelAnimationData *
GetWheelPose
(int32 WheelIndex)
const
;
32
33
private
:
34
35
/// cm/s. A wheel moving faster than this was teleported, and is not turned.
36
UPROPERTY(EditDefaultsOnly, Category =
"CARLA Wheeled Vehicle"
)
37
float
MaxTravelSpeed
= 15000.0f;
38
39
struct
FWheel
40
{
41
/// Reference pose, component space.
42
FVector
RestLocation
= FVector::ZeroVector;
43
44
/// World space, previous update.
45
FVector
LastLocation
= FVector::ZeroVector;
46
47
/// Degrees.
48
float
SpinAngle
= 0.0f;
49
};
50
51
bool
ShouldRollWheels
(
const
ACarlaWheeledVehicle
&
Vehicle
)
const
;
52
53
void
InitWheels
();
54
55
/// World locations of the wheels, kept while not rolling.
56
void
TrackWheelLocations
();
57
58
void
BeginRolling
();
59
60
void
RollWheels
(
const
ACarlaWheeledVehicle
&
Vehicle
,
float
DeltaSeconds);
61
62
void
UpdateWheelAnimationOverride
(
const
ACarlaWheeledVehicle
&
Vehicle
);
63
64
TArray<FWheelAnimationData> &
GetWheelPoses
();
65
66
TArray<FWheel>
Wheels
;
67
68
bool
bRollingWheels
=
false
;
69
70
bool
bWasWheelAnimationOverridden
=
false
;
71
};
Vehicle
@ Vehicle
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Util/EnvironmentObject.h:21
ACarlaWheeledVehicle
Base class for CARLA wheeled vehicles.
Definition
CarlaWheeledVehicle.h:85
UCarlaVehicleAnimationInstance
Parent class of the vehicle animation blueprints.
Definition
CarlaVehicleAnimationInstance.h:23
UCarlaVehicleAnimationInstance::UpdateWheelAnimationOverride
void UpdateWheelAnimationOverride(const ACarlaWheeledVehicle &Vehicle)
Definition
CarlaVehicleAnimationInstance.cpp:134
UCarlaVehicleAnimationInstance::Wheels
TArray< FWheel > Wheels
Definition
CarlaVehicleAnimationInstance.h:66
UCarlaVehicleAnimationInstance::MaxTravelSpeed
float MaxTravelSpeed
cm/s. A wheel moving faster than this was teleported, and is not turned.
Definition
CarlaVehicleAnimationInstance.h:37
UCarlaVehicleAnimationInstance::bWasWheelAnimationOverridden
bool bWasWheelAnimationOverridden
Definition
CarlaVehicleAnimationInstance.h:70
UCarlaVehicleAnimationInstance::InitWheels
void InitWheels()
Definition
CarlaVehicleAnimationInstance.cpp:59
UCarlaVehicleAnimationInstance::BeginRolling
void BeginRolling()
Definition
CarlaVehicleAnimationInstance.cpp:102
UCarlaVehicleAnimationInstance::RollWheels
void RollWheels(const ACarlaWheeledVehicle &Vehicle, float DeltaSeconds)
Definition
CarlaVehicleAnimationInstance.cpp:116
UCarlaVehicleAnimationInstance::bRollingWheels
bool bRollingWheels
Definition
CarlaVehicleAnimationInstance.h:68
UCarlaVehicleAnimationInstance::NativeUpdateAnimation
virtual void NativeUpdateAnimation(float DeltaSeconds) override
Definition
CarlaVehicleAnimationInstance.cpp:27
UCarlaVehicleAnimationInstance::TrackWheelLocations
void TrackWheelLocations()
World locations of the wheels, kept while not rolling.
Definition
CarlaVehicleAnimationInstance.cpp:83
UCarlaVehicleAnimationInstance::ShouldRollWheels
bool ShouldRollWheels(const ACarlaWheeledVehicle &Vehicle) const
Definition
CarlaVehicleAnimationInstance.cpp:52
UCarlaVehicleAnimationInstance::GetWheelPose
const FWheelAnimationData * GetWheelPose(int32 WheelIndex) const
The pose last written for a wheel, or nullptr if there is no such wheel.
Definition
CarlaVehicleAnimationInstance.cpp:160
UCarlaVehicleAnimationInstance::GetWheelPoses
TArray< FWheelAnimationData > & GetWheelPoses()
Definition
CarlaVehicleAnimationInstance.cpp:167
UVehicleAnimationInstance
UCarlaVehicleAnimationInstance::FWheel
Definition
CarlaVehicleAnimationInstance.h:40
UCarlaVehicleAnimationInstance::FWheel::RestLocation
FVector RestLocation
Reference pose, component space.
Definition
CarlaVehicleAnimationInstance.h:42
UCarlaVehicleAnimationInstance::FWheel::SpinAngle
float SpinAngle
Degrees.
Definition
CarlaVehicleAnimationInstance.h:48
UCarlaVehicleAnimationInstance::FWheel::LastLocation
FVector LastLocation
World space, previous update.
Definition
CarlaVehicleAnimationInstance.h:45
Generated by
1.18.0