The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+2 votes

Looks like something that it used to optimize performance in 3D games, but how does it work, and how it should be used?

in Engine by (217 points)

1 Answer

+3 votes
Best answer

Thanks to VisibilityEnabler you can pause animations and freeze physics as well as get information that given object just entered/exited the screen.

To use VisibilityEnabler you need to add it as a child to any spatial node.

You will be able to define concrete size for this enabler from the editor (violet box that you can resize inside the editor), or from the code via set_aabb.

You will be able to use checkboxes (Pause animations | Freeze Bodies) as well.

But usually the main reason to use Visibility Enabler node is to use it's signals, there are couple interesting signals that you can use:

  • enter_screen
  • exit_screen
  • enter_camera
  • exit_camera

Usually I'm using enter_screen and exit_screen to turn on/off processing of a script (basically set_process(true/false))

by (1,299 points)
selected by

is there any specific advantage in using visibilityenabler instead of visibilitynotifier? the signals seem to be the same and you can control set_process on both.

If pause animations or freeze bodies dont matter, are there any special differences between both?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.