Adding 'tick_interval' property for sensors
This commit is contained in:
parent
a2974d3ca1
commit
8a8db23f86
|
@ -218,6 +218,19 @@ static void AddRecommendedValuesForSensorRoleNames(FActorDefinition &Definition)
|
|||
AddRecommendedValuesForActorRoleName(Definition, {TEXT("front"), TEXT("back"), TEXT("left"), TEXT("right"), TEXT("front_left"), TEXT("front_right"), TEXT("back_left"), TEXT("back_right")});
|
||||
}
|
||||
|
||||
static void AddVariationsForSensor(FActorDefinition &Def)
|
||||
{
|
||||
FActorVariation Tick;
|
||||
|
||||
Tick.Id = TEXT("tick_interval");
|
||||
Tick.Type = EActorAttributeType::Float;
|
||||
Tick.RecommendedValues = { TEXT("0.0f") };
|
||||
Tick.bRestrictToRecommended = false;
|
||||
|
||||
Def.Variations.Emplace(Tick);
|
||||
}
|
||||
|
||||
|
||||
FActorDefinition UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition(
|
||||
const FString &Type,
|
||||
const FString &Id)
|
||||
|
@ -225,6 +238,7 @@ FActorDefinition UActorBlueprintFunctionLibrary::MakeGenericSensorDefinition(
|
|||
FActorDefinition Definition;
|
||||
FillIdAndTags(Definition, TEXT("sensor"), Type, Id);
|
||||
AddRecommendedValuesForSensorRoleNames(Definition);
|
||||
AddVariationsForSensor(Definition);
|
||||
return Definition;
|
||||
}
|
||||
|
||||
|
@ -247,6 +261,7 @@ void UActorBlueprintFunctionLibrary::MakeCameraDefinition(
|
|||
{
|
||||
FillIdAndTags(Definition, TEXT("sensor"), TEXT("camera"), Id);
|
||||
AddRecommendedValuesForSensorRoleNames(Definition);
|
||||
AddVariationsForSensor(Definition);
|
||||
// FOV.
|
||||
FActorVariation FOV;
|
||||
FOV.Id = TEXT("fov");
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "GameFramework/Actor.h"
|
||||
|
||||
#include "Carla/Actor/ActorDescription.h"
|
||||
#include "Carla/Actor/ActorBlueprintFunctionLibrary.h"
|
||||
#include "Carla/Sensor/DataStream.h"
|
||||
|
||||
#include "Sensor.generated.h"
|
||||
|
@ -21,7 +22,16 @@ class CARLA_API ASensor : public AActor
|
|||
|
||||
public:
|
||||
|
||||
virtual void Set(const FActorDescription &) {}
|
||||
virtual void Set(const FActorDescription &Description)
|
||||
{
|
||||
// set the tick interval of the sensor
|
||||
if (Description.Variations.Contains("tick_interval"))
|
||||
{
|
||||
SetActorTickInterval(
|
||||
UActorBlueprintFunctionLibrary::ActorAttributeToFloat(Description.Variations["tick_interval"],
|
||||
0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
/// Replace the FDataStream associated with this sensor.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue