set_physics_process(false) does not disable Rigidbody2D nodes - how can I do that?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By trjp

I realize set_physics_process(false) just disables calls to _physics_process() however I assumed that (via inheritance or similar) this would ‘freeze’ all child 2D physics bodies within a node (or even just disable that actual node - which it also doesn’t do).

Why would I disable physics for a node but expect physics to continue?? :slight_smile:

The only way I can find to achieve this is either to remove the node from the tree (I need the objects to still be drawn so this isn’t a solution), disable the Physics2DEngine (works but seems like a sledgehammer to crack a nut) or manually find and ‘freeze’ all nodes (which means manually unfreezing them later which is a massive faff)

What am I missing here - how can I disable all physics for a Node and it’s children easily?

:bust_in_silhouette: Reply From: jgodfrey

AFAIK, the answer here is probably your best bet…

https://forum.godotengine.org/32985/remove-temporarily-from-physic-world-set_physics_process

The problem there is you lose the ‘state’ of the physics object (speed, direction etc.) so it’s not pausing, it’s ‘freezing forever’

You’d also have to traverse a Node looking for all Physics objects which is a pain - esp if yuo have to ‘remember’ the state of each one

I think I need to consider using something other than Godot here - it’s approach to “pause” in general and esp. in relation to physics is a bit shit

trjp | 2020-05-14 11:09