summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-10-27 23:18:16 +0100
committerGitHub <noreply@github.com>2020-10-27 23:18:16 +0100
commit98ee852fd366961eff8b4aa1cddcceec4ff52ece (patch)
treedfb65409364340c4f07a1f3bc8c3e4a9f36b70d4
parentbc1eaab3d8802c19a8551b6b443ac675b0ed7e98 (diff)
parentb3a6937c0c36fcca761d4c18a6d711bdb24a967e (diff)
Merge pull request #43139 from Calinou/doc-unproject-position-behind
Document hiding a Control when its reference point is behind the camera
-rw-r--r--doc/classes/Camera3D.xml7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml
index b6a108fb25..b3fe452b12 100644
--- a/doc/classes/Camera3D.xml
+++ b/doc/classes/Camera3D.xml
@@ -163,6 +163,13 @@
</argument>
<description>
Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in worldspace.
+ [b]Note:[/b] When using this to position GUI elements over a 3D viewport, use [method is_position_behind] to prevent them from appearing if the 3D point is behind the camera:
+ [codeblock]
+ # This code block is part of a script that inherits from Node3D.
+ # `control` is a reference to a node inheriting from Control.
+ control.visible = not get_viewport().get_camera().is_position_behind(global_transform.origin)
+ control.rect_position = get_viewport().get_camera().unproject_position(global_transform.origin)
+ [/codeblock]
</description>
</method>
</methods>