Add supported drivers option to vehicle parameters

This commit is contained in:
nsubiron 2019-06-11 16:37:22 +02:00
parent 4f27ff0067
commit 83769d9914
2 changed files with 19 additions and 0 deletions

View File

@ -416,6 +416,7 @@ void UActorBlueprintFunctionLibrary::MakeVehicleDefinition(
AddRecommendedValuesForActorRoleName(Definition,
{TEXT("autopilot"), TEXT("scenario"), TEXT("ego_vehicle")});
Definition.Class = Parameters.Class;
if (Parameters.RecommendedColors.Num() > 0)
{
FActorVariation Colors;
@ -429,6 +430,19 @@ void UActorBlueprintFunctionLibrary::MakeVehicleDefinition(
Definition.Variations.Emplace(Colors);
}
if (Parameters.SupportedDrivers.Num() > 0)
{
FActorVariation Drivers;
Drivers.Id = TEXT("driver_id");
Drivers.Type = EActorAttributeType::Int;
Drivers.bRestrictToRecommended = true;
for (auto &Id : Parameters.SupportedDrivers)
{
Drivers.RecommendedValues.Emplace(FString::FromInt(Id));
}
Definition.Variations.Emplace(Drivers);
}
FActorVariation StickyControl;
StickyControl.Id = TEXT("sticky_control");
StickyControl.Type = EActorAttributeType::Bool;

View File

@ -33,4 +33,9 @@ struct CARLA_API FVehicleParameters
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<FColor> RecommendedColors;
/// List of IDs of the drivers (pedestrians) supported by this vehicle, leave
/// empty if no driver is supported.
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<int32> SupportedDrivers;
};