Godot Version
v4.2.2
Question
As the title said, I am wondering if it is a good approach to apply physic (i.e call ApplyImpulse
) directly when a timer got timeout. Or should I set a flag on timer timeout and check that flag on _PhysicsProcess
and run ApplyImpulse
if the flag is true?
so someting like this:
private void Timeout() {
ApplyImpulse(x, y, z);
}
or this?
public override void _PhysicsProcess(double delta) {
if (triggered) {
ApplyImpulse(x, y, z);
triggered = false;
}
}
private void Timeout() {
triggered = true;
}
I tried both, and I can’t find any differences
Personally, I prefer doing it directly on timeout, if possible. Since it is simpler and more straight-forward…but I am not sure whether it is ok to apply it outside of physics process…
Thanks in advance!!