Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pausing tree disables white-listed Area2D's signals #62180

Closed
markdibarry opened this issue Jun 18, 2022 · 9 comments
Closed

Pausing tree disables white-listed Area2D's signals #62180

markdibarry opened this issue Jun 18, 2022 · 9 comments

Comments

@markdibarry
Copy link
Contributor

markdibarry commented Jun 18, 2022

Godot version

3.5 RC4

System information

Windows 10

Issue description

When pausing the scene tree, and an Area2D is white-listed to process while paused, the body_entered signals are not fired.

2022-06-18.10-55-28.mp4

Steps to reproduce

  1. Create a scene with a white-listed branch.
  2. Have the branch contain a moveable body and Area2D
  3. Set Area2D's body_entered signal to notify when body has entered.
  4. pause tree and move body over Area2D

Minimal reproduction project

CollisionBug.zip

@Zireael07
Copy link
Contributor

I believe this has already been reported.

@markdibarry
Copy link
Contributor Author

markdibarry commented Jun 18, 2022

I looked through open issues and #45334 but I couldn't find it.

@Zireael07
Copy link
Contributor

#61420 I think is what I remember. Not all issues are listed on the tracker

@markdibarry
Copy link
Contributor Author

markdibarry commented Jun 18, 2022

Ah! That one is specific to 4.0, and has a different result with the new pause system, causing the signal to be removed entirely or throw errors, depending on the node tree order.

This one is for 3.x, where pausing the scene tree stops Area2Ds from working regardless of whether or not they're white-listed.

@lapspider45
Copy link

Workaround: call Physics2DServer.set_active(true) after pausing the tree.

A side effect of get_tree().paused = true is to disable the physics engine. It is documented, just not very clearly:
https://docs.godotengine.org/en/stable/classes/class_scenetree.html#class-scenetree-property-paused

@markdibarry
Copy link
Contributor Author

markdibarry commented Jun 18, 2022

Hm. This does resume the physics server, but still seems like an unintentional side-effect. It's a far-reaching workaround, because with the pause system currently, it means either:

  1. White-listed nodes don't behave as white-listed (physics disabled for all).
  2. Paused nodes don't behave as paused (physics enabled for all).

Unless I'm misunderstanding and the workaround only resumes the Physics server for nodes set to process while paused.

@Calinou
Copy link
Member

Calinou commented Jun 18, 2022

I don't think this can be resolved unless something like #46191 is backported in a backwards-compatible manner, which sounds too difficult to do.

@Calinou Calinou added documentation and removed bug labels Jun 18, 2022
@markdibarry
Copy link
Contributor Author

@Calinou The mentioned rewrite introduces it's own set of (worse?) Area2D bugs (mentioned a few comments above), but you're absolutely right. It's probably not worth spending the effort to backport the fix to 3.x in the long-run and just focus on 4.0. It seems like, for now, the best solution is either a custom pause system in 3.x or wait for Area2D to be fixed in 4.0.

As reference for anyone else who needs to be able to pause in 3.x without this bug, nodes have the following methods you can use to emulate a custom system, by iterating through a branch:
set_physics_process()
set_physics_process_internal()
set_process()
set_process_internal()
set_process_input()
Keep in mind it can be brittle so node reparenting should be kept to a minimum.

@markdibarry
Copy link
Contributor Author

Closing since it can't be fixed in 3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants