From f2695a17d17432fee31bccfaa28bce33b0169b94 Mon Sep 17 00:00:00 2001 From: Blyron <53337103+Blyron@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:10:11 +0200 Subject: [PATCH] Aaron/fixwheelchair (#8001) * Fix OSM2ODR build * Updated fix wheelchair default value --- PythonAPI/examples/generate_traffic.py | 3 +++ .../Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp | 4 ++-- .../Plugins/Carla/Source/Carla/Walker/WalkerBase.cpp | 6 ++++++ .../CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PythonAPI/examples/generate_traffic.py b/PythonAPI/examples/generate_traffic.py index b3b646abf..ef1ec66b3 100755 --- a/PythonAPI/examples/generate_traffic.py +++ b/PythonAPI/examples/generate_traffic.py @@ -279,8 +279,11 @@ def main(): for spawn_point in spawn_points: walker_bp = random.choice(blueprintsWalkers) # set as not invincible + probability = random.randint(0,100 + 1); if walker_bp.has_attribute('is_invincible'): walker_bp.set_attribute('is_invincible', 'false') + if walker_bp.has_attribute('can_use_wheelchair') and probability < 11: + walker_bp.set_attribute('use_wheelchair', 'true') # set the max speed if walker_bp.has_attribute('speed'): if (random.random() > percentagePedestriansRunning): diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp index 823859d4d..dd657d6c2 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorBlueprintFunctionLibrary.cpp @@ -1595,7 +1595,7 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( Definition.Attributes.Emplace(FActorAttribute{ - TEXT("can_use_wheel_chair"), + TEXT("can_use_wheelchair"), EActorAttributeType::Bool, Parameters.bCanUseWheelChair ? TEXT("true") : TEXT("false") }); @@ -1626,7 +1626,7 @@ void UActorBlueprintFunctionLibrary::MakePedestrianDefinition( WheelChairVariation.Type = EActorAttributeType::Bool; if(bCanUseWheelChair) { - WheelChairVariation.RecommendedValues = { TEXT("true"), TEXT("false") }; + WheelChairVariation.RecommendedValues = { TEXT("false"), TEXT("true") }; } else { diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.cpp index 598bfd4bc..9bae6381b 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.cpp @@ -5,3 +5,9 @@ // For a copy, see . #include "WalkerBase.h" + + +AWalkerBase::AWalkerBase(const FObjectInitializer &ObjectInitializer) + : Super(ObjectInitializer) +{ +} \ No newline at end of file diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h index 5990bceeb..1ac0014f4 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Walker/WalkerBase.h @@ -16,6 +16,7 @@ class CARLA_API AWalkerBase : public ACharacter GENERATED_BODY() + AWalkerBase(const FObjectInitializer &ObjectInitializer); public: UPROPERTY(Category="Walker Base", BlueprintReadWrite, EditAnywhere)