class_visibilityenabler.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisibilityEnabler.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisibilityEnabler:
  6. VisibilityEnabler
  7. =================
  8. **Inherits:** :ref:`VisibilityNotifier<class_VisibilityNotifier>` **<** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Enables certain nodes only when approximately visible.
  10. Description
  11. -----------
  12. The VisibilityEnabler will disable :ref:`RigidBody<class_RigidBody>` and :ref:`AnimationPlayer<class_AnimationPlayer>` nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler itself.
  13. If you just want to receive notifications, use :ref:`VisibilityNotifier<class_VisibilityNotifier>` instead.
  14. **Note:** VisibilityEnabler uses an approximate heuristic for performance reasons. It doesn't take walls and other occlusion into account (unless you are using :ref:`Portal<class_Portal>`\ s). The heuristic is an implementation detail and may change in future versions. If you need precise visibility checking, use another method such as adding an :ref:`Area<class_Area>` node as a child of a :ref:`Camera<class_Camera>` node and/or :ref:`Vector3.dot<class_Vector3_method_dot>`.
  15. **Note:** VisibilityEnabler will not affect nodes added after scene initialization.
  16. Properties
  17. ----------
  18. +-------------------------+----------------------------------------------------------------------------+----------+
  19. | :ref:`bool<class_bool>` | :ref:`freeze_bodies<class_VisibilityEnabler_property_freeze_bodies>` | ``true`` |
  20. +-------------------------+----------------------------------------------------------------------------+----------+
  21. | :ref:`bool<class_bool>` | :ref:`pause_animations<class_VisibilityEnabler_property_pause_animations>` | ``true`` |
  22. +-------------------------+----------------------------------------------------------------------------+----------+
  23. Methods
  24. -------
  25. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_enabler_enabled<class_VisibilityEnabler_method_is_enabler_enabled>` **(** :ref:`Enabler<enum_VisibilityEnabler_Enabler>` enabler **)** |const| |
  27. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_enabler<class_VisibilityEnabler_method_set_enabler>` **(** :ref:`Enabler<enum_VisibilityEnabler_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)** |
  29. +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. Enumerations
  31. ------------
  32. .. _enum_VisibilityEnabler_Enabler:
  33. .. _class_VisibilityEnabler_constant_ENABLER_PAUSE_ANIMATIONS:
  34. .. _class_VisibilityEnabler_constant_ENABLER_FREEZE_BODIES:
  35. .. _class_VisibilityEnabler_constant_ENABLER_MAX:
  36. enum **Enabler**:
  37. - **ENABLER_PAUSE_ANIMATIONS** = **0** --- This enabler will pause :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
  38. - **ENABLER_FREEZE_BODIES** = **1** --- This enabler will freeze :ref:`RigidBody<class_RigidBody>` nodes.
  39. - **ENABLER_MAX** = **2** --- Represents the size of the :ref:`Enabler<enum_VisibilityEnabler_Enabler>` enum.
  40. Property Descriptions
  41. ---------------------
  42. .. _class_VisibilityEnabler_property_freeze_bodies:
  43. - :ref:`bool<class_bool>` **freeze_bodies**
  44. +-----------+----------------------+
  45. | *Default* | ``true`` |
  46. +-----------+----------------------+
  47. | *Setter* | set_enabler(value) |
  48. +-----------+----------------------+
  49. | *Getter* | is_enabler_enabled() |
  50. +-----------+----------------------+
  51. If ``true``, :ref:`RigidBody<class_RigidBody>` nodes will be paused.
  52. ----
  53. .. _class_VisibilityEnabler_property_pause_animations:
  54. - :ref:`bool<class_bool>` **pause_animations**
  55. +-----------+----------------------+
  56. | *Default* | ``true`` |
  57. +-----------+----------------------+
  58. | *Setter* | set_enabler(value) |
  59. +-----------+----------------------+
  60. | *Getter* | is_enabler_enabled() |
  61. +-----------+----------------------+
  62. If ``true``, :ref:`AnimationPlayer<class_AnimationPlayer>` nodes will be paused.
  63. Method Descriptions
  64. -------------------
  65. .. _class_VisibilityEnabler_method_is_enabler_enabled:
  66. - :ref:`bool<class_bool>` **is_enabler_enabled** **(** :ref:`Enabler<enum_VisibilityEnabler_Enabler>` enabler **)** |const|
  67. Returns whether the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler_Enabler>` constant is active.
  68. ----
  69. .. _class_VisibilityEnabler_method_set_enabler:
  70. - void **set_enabler** **(** :ref:`Enabler<enum_VisibilityEnabler_Enabler>` enabler, :ref:`bool<class_bool>` enabled **)**
  71. Sets active state of the enabler identified by given :ref:`Enabler<enum_VisibilityEnabler_Enabler>` constant.
  72. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  73. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  74. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`