CARLA
Loading...
Searching...
No Matches
BoundingBoxCalculator.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
10
11#include "Kismet/BlueprintFunctionLibrary.h"
12
13#include "GameFramework/Actor.h"
14
15#include "BoundingBoxCalculator.generated.h"
16
17UCLASS()
19{
20 GENERATED_BODY()
21
22public:
23
24 /// Compute the bounding box of the given Carla actor.
25 ///
26 /// @warning If the actor type is not supported a default initialized bounding
27 /// box is returned.
28 ///
29 /// @warning Traffic signs return its trigger box instead.
30 UFUNCTION(Category = "Carla Actor", BlueprintCallable)
31 static FBoundingBox GetActorBoundingBox(
32 const AActor *Actor,
33 uint8 InTagQueried = 0xFF);
34
35 UFUNCTION(Category = "Carla Actor", BlueprintCallable)
36 static FBoundingBox GetVehicleBoundingBox(
38 uint8 InTagQueried = 0xFF);
39
40 UFUNCTION(Category = "Carla Actor", BlueprintCallable)
41 static FBoundingBox GetCharacterBoundingBox(
42 const ACharacter* Character,
43 uint8 InTagQueried = 0xFF);
44
45 UFUNCTION(Category = "Carla Actor", BlueprintCallable)
46 static void GetTrafficLightBoundingBox(
48 TArray<FBoundingBox>& OutBB,
49 TArray<uint8>& OutTag,
50 uint8 InTagQueried = 0xFF);
51
52 UFUNCTION(Category = "Carla Util", BlueprintCallable)
53 static FBoundingBox GetSkeletalMeshBoundingBoxFromComponent(const USkeletalMeshComponent* SkeletalMeshComp);
54
55 UFUNCTION(Category = "Carla Util", BlueprintCallable)
56 static FBoundingBox GetSkeletalMeshBoundingBox(const USkeletalMesh* SkeletalMesh);
57
58 UFUNCTION(Category = "Carla Util", BlueprintCallable)
59 static FBoundingBox GetStaticMeshBoundingBox(const UStaticMesh* StaticMesh);
60
61 UFUNCTION(Category = "Carla Util", BlueprintCallable)
62 static void GetISMBoundingBox(
63 UInstancedStaticMeshComponent* ISMComp,
64 TArray<FBoundingBox>& OutBoundingBox);
65
66 UFUNCTION(Category = "Carla Util", BlueprintCallable)
67 static void GetBBsOfStaticMeshComponents(
68 const TArray<UStaticMeshComponent*>& StaticMeshComps,
69 TArray<FBoundingBox>& OutBB,
70 TArray<uint8>& OutTag,
71 uint8 InTagQueried = 0xFF);
72
73 UFUNCTION(Category = "Carla Util", BlueprintCallable)
74 static void GetBBsOfSkeletalMeshComponents(
75 const TArray<USkeletalMeshComponent*>& SkeletalMeshComps,
76 TArray<FBoundingBox>& OutBB,
77 TArray<uint8>& OutTag,
78 uint8 InTagQueried = 0xFF);
79
80 UFUNCTION(Category = "Carla Util", BlueprintCallable)
81 static TArray<FBoundingBox> GetBoundingBoxOfActors(
82 const TArray<AActor*>& Actors,
83 uint8 InTagQueried = 0xFF);
84
85 UFUNCTION(Category = "Carla Util", BlueprintCallable)
86 static TArray<FBoundingBox> GetBBsOfActor(
87 const AActor* Actor,
88 uint8 InTagQueried = 0xFF);
89
90 // Combines the BBs of an actor based on the distance and type of the BB
91 // The BBs not combined are included too (ie: TL BBs and pole)
92 // DistanceThreshold is the maximum distance between BBs to combine, if 0.0 the distance is ignored
93 // TagToCombine defines the type of the BBs to combine, if 0 the type is ignored
94 UFUNCTION(Category = "Carla Util", BlueprintCallable)
95 static void CombineBBsOfActor(
96 const AActor* Actor,
97 TArray<FBoundingBox>& OutBB,
98 TArray<uint8>& OutTag,
99 const float DistanceThreshold = 0.0f,
100 uint8 TagToCombine = 0xFF);
101
102 UFUNCTION(Category = "Carla Util", BlueprintCallable)
103 static FBoundingBox CombineBBs(const TArray<FBoundingBox>& BBsToCombine);
104
105 UFUNCTION(Category = "Carla Util", BlueprintCallable)
106 static FBoundingBox CombineBoxes(const TArray<UBoxComponent *>& BBsToCombine);
107
108 // Returns Static Mesh Components that generate the InBB of the Actor
109 // ie: the SMComps that creates the BB of the TL light box
110 UFUNCTION(Category = "Carla Actor", BlueprintCallable)
111 static void GetMeshCompsFromActorBoundingBox(
112 const AActor* Actor,
113 const FBoundingBox& InBB,
114 TArray<UStaticMeshComponent*>& OutStaticMeshComps);
115
116};
Base class for CARLA wheeled vehicles.