diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-04-28 11:19:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 11:19:16 +0200 |
commit | d8066aa6a4afb12ffddcec71bd7e051dcd04f3e1 (patch) | |
tree | 84294ae4cb217205b7a4b0fb3fb71065ff8971eb | |
parent | 717f053e371f39b65ae1694901056580e1a8d6f9 (diff) | |
parent | d49ff7aff7783a6334de48f7086752a713590e5c (diff) |
Merge pull request #38286 from bojidar-bg/x-expose-cell-size
Expose the cell_size affecting VisibilityNotifier2D precision
-rw-r--r-- | doc/classes/ProjectSettings.xml | 3 | ||||
-rw-r--r-- | doc/classes/VisibilityEnabler2D.xml | 2 | ||||
-rw-r--r-- | doc/classes/VisibilityNotifier2D.xml | 2 | ||||
-rw-r--r-- | scene/resources/world_2d.cpp | 2 |
4 files changed, 6 insertions, 3 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 6dae3209b9..9e917fb4dd 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -1169,6 +1169,9 @@ </member> <member name="rendering/vulkan/staging_buffer/texture_upload_region_size_px" type="int" setter="" getter="" default="64"> </member> + <member name="world/2d/cell_size" type="int" setter="" getter="" default="100"> + Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses. + </member> </members> <constants> </constants> diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index f0e4c999ac..a5abf16a8d 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -5,7 +5,7 @@ </brief_description> <description> The VisibilityEnabler2D will disable [RigidBody2D], [AnimationPlayer], and other nodes when they are not visible. It will only affect nodes with the same root node as the VisibilityEnabler2D, and the root node itself. - [b]Note:[/b] VisibilityEnabler2D uses an approximate heuristic for performance reasons. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node. + [b]Note:[/b] For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node. [b]Note:[/b] VisibilityEnabler2D will not affect nodes added after scene initialization. </description> <tutorials> diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml index 813f74f404..391163ef94 100644 --- a/doc/classes/VisibilityNotifier2D.xml +++ b/doc/classes/VisibilityNotifier2D.xml @@ -5,7 +5,7 @@ </brief_description> <description> The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport. - [b]Note:[/b] VisibilityNotifier2D uses an approximate heuristic for performance reasons. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node. + [b]Note:[/b] For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node. </description> <tutorials> </tutorials> diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index 742ef106d9..f2f67d3814 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -314,7 +314,7 @@ struct SpatialIndexer2D { pass = 0; changed = false; - cell_size = 100; //should be configurable with GLOBAL_DEF("") i guess + cell_size = GLOBAL_DEF("world/2d/cell_size", 100); } }; |