CARLA
Loading...
Searching...
No Matches
CollisionSensor.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
11
12#include "CollisionSensor.generated.h"
13
14class UCarlaEpisode;
16
17/// A sensor to register collisions.
18UCLASS()
19class CARLA_API ACollisionSensor : public ASensor
20{
21 GENERATED_BODY()
22
23public:
24
25 static FActorDefinition GetSensorDefinition();
26
27 ACollisionSensor(const FObjectInitializer& ObjectInitializer);
28
29 void SetOwner(AActor *NewOwner) override;
30
31private:
32
33 UFUNCTION()
34 void OnCollisionEvent(
35 AActor *Actor,
36 AActor *OtherActor,
37 FVector NormalImpulse,
38 const FHitResult &Hit);
39
40 /// Registry that saves all collisions. Used to avoid sending the same collision more than once per frame,
41 /// as the collision sensor uses the PhysX substepping tick. Helps with sensor usage and stream overload.
42 std::vector<std::tuple<uint64_t, AActor*, AActor*>> CollisionRegistry;
43};
A sensor to register collisions.
std::vector< std::tuple< uint64_t, AActor *, AActor * > > CollisionRegistry
Registry that saves all collisions.
A simulation episode.
The game instance contains elements that must be kept alive in between levels.
A definition of a Carla Actor with all the variation and attributes.