summaryrefslogtreecommitdiff
path: root/doc/classes/Camera3D.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Camera3D.xml')
-rw-r--r--doc/classes/Camera3D.xml8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml
index 598b4bd685..b3fe452b12 100644
--- a/doc/classes/Camera3D.xml
+++ b/doc/classes/Camera3D.xml
@@ -7,6 +7,7 @@
[Camera3D] is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed.
</description>
<tutorials>
+ <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
</tutorials>
<methods>
<method name="clear_current">
@@ -162,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>