diff --git a/CHANGELOG.md b/CHANGELOG.md index 045ab0c5e..511564100 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ * Updated OpenDriveActor to use the new Waypoint API * Fixed wrong units in VehiclePhysicsControl's center of mass * Several optimizations to the RPC server, now supports a bigger load of async messages + * Exposed 'is_invincible' for pedestrians ## CARLA 0.9.5 @@ -75,6 +76,7 @@ * Fixed obstacle detector not working * Fixed small float bug in misc.py + ## CARLA 0.9.4 * Added recording and playback functionality diff --git a/PythonAPI/examples/manual_control.py b/PythonAPI/examples/manual_control.py index c121035dc..40edafeb8 100755 --- a/PythonAPI/examples/manual_control.py +++ b/PythonAPI/examples/manual_control.py @@ -171,6 +171,8 @@ class World(object): if blueprint.has_attribute('color'): color = random.choice(blueprint.get_attribute('color').recommended_values) blueprint.set_attribute('color', color) + if blueprint.has_attribute('is_invincible'): + blueprint.set_attribute('is_invincible', 'true') # Spawn the player. if self.player is not None: spawn_point = self.player.get_transform() diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp index 700081060..45f4d766b 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp @@ -438,6 +438,15 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( EActorAttributeType::String, GetGender(Parameters.Gender)}); + FActorVariation IsInvincible; + + IsInvincible.Id = TEXT("is_invincible"); + IsInvincible.Type = EActorAttributeType::Bool; + IsInvincible.RecommendedValues = { TEXT("true") }; + IsInvincible.bRestrictToRecommended = false; + + Definition.Variations.Emplace(IsInvincible); + Success = CheckActorDefinition(Definition); }