hot fix ignore spectator variable on replayer

This commit is contained in:
Blyron 2024-05-28 11:53:19 +02:00 committed by Blyron
parent 7b2ff04496
commit a2ae705126
3 changed files with 8 additions and 3 deletions

View File

@ -808,7 +808,7 @@ void CarlaReplayer::InterpolatePosition(
double DeltaTime) double DeltaTime)
{ {
// call the callback // call the callback
Helper.ProcessReplayerPosition(Pos1, Pos2, Per, DeltaTime); Helper.ProcessReplayerPosition(Pos1, Pos2, Per, DeltaTime, IgnoreSpectator);
} }
// tick for the replayer // tick for the replayer

View File

@ -296,7 +296,7 @@ bool CarlaReplayerHelper::ProcessReplayerEventParent(uint32_t ChildId, uint32_t
} }
// reposition actors // reposition actors
bool CarlaReplayerHelper::ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime) bool CarlaReplayerHelper::ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime, bool bIgnoreSpectator)
{ {
check(Episode != nullptr); check(Episode != nullptr);
FCarlaActor* CarlaActor = Episode->FindCarlaActor(Pos1.DatabaseId); FCarlaActor* CarlaActor = Episode->FindCarlaActor(Pos1.DatabaseId);
@ -304,6 +304,11 @@ bool CarlaReplayerHelper::ProcessReplayerPosition(CarlaRecorderPosition Pos1, Ca
FRotator Rotation; FRotator Rotation;
if(CarlaActor) if(CarlaActor)
{ {
//Hot fix to avoid spectator we should investigate why this case is possible here
if(bIgnoreSpectator && CarlaActor->GetActor()->GetClass()->GetFName().ToString().Contains("Spectator"))
{
return false;
}
// check to assign first position or interpolate between both // check to assign first position or interpolate between both
if (Per == 0.0) if (Per == 0.0)
{ {

View File

@ -52,7 +52,7 @@ public:
bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId); bool ProcessReplayerEventParent(uint32_t ChildId, uint32_t ParentId);
// reposition actors // reposition actors
bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime); bool ProcessReplayerPosition(CarlaRecorderPosition Pos1, CarlaRecorderPosition Pos2, double Per, double DeltaTime, bool bIgnoreSpectator);
// replay event for traffic light state // replay event for traffic light state
bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State); bool ProcessReplayerStateTrafficLight(CarlaRecorderStateTrafficLight State);