adding check to the collision sensor

This commit is contained in:
bernatx 2023-06-08 09:56:43 +02:00 committed by bernat
parent 4eb8b614cd
commit c20cb80b8d
1 changed files with 5 additions and 1 deletions

View File

@ -77,11 +77,15 @@ void ACollisionSensor::OnCollisionEvent(
const auto &Episode = GetEpisode();
constexpr float TO_METERS = 1e-2;
NormalImpulse *= TO_METERS;
GetDataStream(*this).Send(
if (IsStreamReady())
{
GetDataStream(*this).Send(
*this,
Episode.SerializeActor(Actor),
Episode.SerializeActor(OtherActor),
carla::geom::Vector3D{NormalImpulse.X, NormalImpulse.Y, NormalImpulse.Z});
}
// record the collision event
if (Episode.GetRecorder()->IsEnabled()){
Episode.GetRecorder()->AddCollision(Actor, OtherActor);