-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Physics2DServer.set_active(false) doesn't work #46158
Comments
The kinematic body doesn't stop because you continue to call move_and_slide in the code. But if you try it with a plain rigidbody2D it does stop. |
Yes, this only seems to affect rigid bodies. As a user, I'd expect all physics interactions to be disabled, though. Perhaps the method should be renamed to godot/servers/physics_2d/physics_server_2d_sw.cpp Lines 1249 to 1267 in 81fc37b
There's also a related proposal to allow manual physics stepping, see godotengine/godot-proposals#236, so perhaps the method could be eventually adapted to work something along the lines of |
It sure would be nice for it to stop all physics related things. Perhaps they can relabel the current behaviour to set_stepping_active(), but also eventually reimplement set_active() to disable all physics objects.. Essentially if it isn't active, no calls to _physics_process(delta) should be made |
Yes, I'm not sure about this myself, technically this is a bug (to maintainers: if someone thinks the same, please assign the "bug" label). But currently I think that's just badly documented feature. Yet for this to be functional in your case, I see no The potential fix is checking the In any case, need feedback from the @godotengine/physics team to determine whether it's a bug or not (or more users stumbling upon the same limitation as you do). 🙂 I'd personally treat this as a bug, but I'm afraid that the consensus may be different. |
I wouldn't consider this exactly a bug, but it would make sense to make things more consistent. Based on the previous suggestions this could be done easily:
|
I think this approach makes sense since I also think that But again, from the user standpoint (and if I were to stumble upon the same issue myself), this is unexpected, all physics interactions should be disabled if That's why I suggested that |
I would like to trigger a warning instead of just disabling the motion silently (even if just warning once). The reason is users can catch cases where an object is trying to use physics logic while the server is not active (with possibly some more stuff that shouldn't be run in physics process in this case). And it can also help with compatibility breakage if |
If it's just for deprecation which the intention that the message will be removed in the future, sure. But I'm usually not in favor of redundant run-time warnings (even if they're printed once), because if you do use See other cases such as #24222, or even #43783. Run-time warnings can be added, but since there's no easy way to disable them, those warnings get in the way of more important warnings such as GDScript warnings. Note that I'm talking purely about Godot 4.0 changes, not 3.2 (current behavior should remain the same as in 3.2 I think, |
The warning message is not intended to add noise, but to tell users what to fix. The point would be that it's not allowed to call the move functions while the server is inactive, and users would have to use So the warning would be something like: |
That's the point I'm trying to convey: why should a user call To comment on your previous statements:
I understand, but I can't find a concrete use case where this would become problematic.
I'd go for complete compatibility breakage for 4.0 if those changes do improve the experience, I recall many other people preferred the same development approach for 4.0. That's all my feedback for this issue, I don't want to potentially speculate on the problem which might not be a big deal at the end of the day. 🙂 |
I don't think checking if the server is active in _physics_process(delta) makes sense.. A user would assume that the Physics Server is active if the physics call is being made. So rename the function from set_active(state) to set_stepping(state), and also change is_active() to is_stepping() |
What should we do if we want to implement our own physics? This callback is used for more than PhysicsServer related stuff. There might be other physics code running. I think it makes sense having a physics process callback whether the built-in PhysicsServer is active or not. |
Godot version:
v3.2.3.stable.mono.official
v3.2.2.stable
OS/device including version:
Windows 10
Issue description:
Physics2DServer.set_active(false) doesn't disable the physics server.
I was expecting 2D physics to be disabled.
I don't know if Physics2DServer.set_active(true) works, because I can't disable physics in the first place..
Steps to reproduce:
in gd script call Physics2DServer.set_active(false)
in C# call Physics2DServer.SetActive(false)
Minimal reproduction project:
Physics2DSetActive.zip
The text was updated successfully, but these errors were encountered: