Is there an elegant and built in way to delegate actions (aka method calls) to physics_process() ?

dotteddotted Posts: 33Member

As a case example:
Polling Input for keypresses during physics_process() is distasteful. Queuing up a method call in _input() for subsequent processing during physics_process() is 'better' code because you aren't doing input logic in a time critical method like _physics_process().

Conceptually this would be signals but ones only executed in physics_process()


Tags :

Answers

  • vinpogovinpogo Posts: 26Member

    i dont think there is a better way than you already said, by queuing a method to be executed in the physics_process.

    Out of curiosity: Why do you think its distateful?

  • dotteddotted Posts: 33Member

    In general, polling for inputs when they are provided by events, especially during a time critical call like physics processing. It's not an issue if the physics call doesn't do too much, but it grinds my real-time background.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file