Hello
I have created an actor that activates a trigger when Multiple Booleans are set to true, but I’ve noticed when it activates, the programme is hit by extreme lag spikes. The code describes is the if statement commented below:
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (Scrnsht) {
TriggerOccur();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
if (P_Pressed_MyActor && DoOnce) {
DAQmxClearTask(taskHandle1);
UE_LOG(LogTemp, Log, TEXT(“Hello”));
(DAQmxCreateTask(“”, &taskHandle1));
(DAQmxCreateDOChan(taskHandle1, “Dev1/port0/line0:7”, “”, DAQmx_Val_ChanForAllLines));
(DAQmxStartTask(taskHandle1));
DoOnce = false;
}
/*if (!DoOnce) {
if (X_Correct && Y_Correct && Z_Correct && X_AngleCorrect && Y_AngleCorrect && Z_AngleCorrect && Delay) {
Delay = false;
(DAQmxWriteDigitalLines(taskHandle1, 1, 1, 10.0, DAQmx_Val_GroupByChannel, dataD, NULL, NULL));
(DAQmxWriteDigitalLines(taskHandle1, 1, 1, 10.0, DAQmx_Val_GroupByChannel, dataU, NULL, NULL));
(DAQmxWriteDigitalLines(taskHandle1, 1, 1, 10.0, DAQmx_Val_GroupByChannel, dataD, NULL, NULL));
std::this_thread::sleep_for(std::chrono::milliseconds(Period_milliseconds));
Delay = true;
}
}*/
}
I believe the way I have coded it is the issue but am unsure what I did wrong