Added tick control on sensor for sensor_tick attribute
This commit is contained in:
parent
fa2cde9ace
commit
2317e35f98
|
@ -24,7 +24,7 @@ void ASensor::BeginPlay()
|
|||
{
|
||||
Super::BeginPlay();
|
||||
OnPostTickDelegate = FWorldDelegates::OnWorldPostActorTick.AddUObject(
|
||||
this, &ASensor::PostPhysTick);
|
||||
this, &ASensor::PostPhysTickInternal);
|
||||
}
|
||||
|
||||
void ASensor::Set(const FActorDescription &Description)
|
||||
|
@ -41,6 +41,7 @@ void ASensor::Set(const FActorDescription &Description)
|
|||
void ASensor::Tick(const float DeltaTime)
|
||||
{
|
||||
Super::Tick(DeltaTime);
|
||||
ReadyToTick = true;
|
||||
PrePhysTick(DeltaTime);
|
||||
}
|
||||
|
||||
|
@ -77,3 +78,12 @@ void ASensor::EndPlay(EEndPlayReason::Type EndPlayReason)
|
|||
|
||||
FWorldDelegates::OnWorldPostActorTick.Remove(OnPostTickDelegate);
|
||||
}
|
||||
|
||||
void ASensor::PostPhysTickInternal(UWorld *World, ELevelTick TickType, float DeltaSeconds)
|
||||
{
|
||||
if(ReadyToTick)
|
||||
{
|
||||
PostPhysTick(World, TickType, DeltaSeconds);
|
||||
ReadyToTick = false;
|
||||
}
|
||||
}
|
|
@ -101,9 +101,14 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
void PostPhysTickInternal(UWorld *World, ELevelTick TickType, float DeltaSeconds);
|
||||
|
||||
FDataStream Stream;
|
||||
|
||||
FDelegateHandle OnPostTickDelegate;
|
||||
|
||||
const UCarlaEpisode *Episode = nullptr;
|
||||
|
||||
/// Allows the sensor to tick with the tick rate from UE4.
|
||||
bool ReadyToTick = false;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue