WaitForFixedUpdate
Namespace:
namespace Lenga\Engine\Core;
class WaitForFixedUpdate
Methods
resumePhase
public function resumePhase()
keepWaiting
public function keepWaiting()
Example
use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\WaitForFixedUpdate;
class PhysicsSynchronizedAction extends Behaviour
{
public function start(): void
{
$this->startCoroutine($this->physicsSync());
}
private function physicsSync(): \Generator
{
Debug::log('Waiting for physics frame...');
// Wait until the next fixed update
yield new WaitForFixedUpdate();
Debug::log('One physics frame has completed');
// Can now safely access physics simulation results
}
}