You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Merge pull request #43139 from Calinou/doc-unproject-position-behind
Document hiding a Control when its reference point is behind the camera
This commit is contained in:
@@ -163,6 +163,13 @@
|
|||||||
</argument>
|
</argument>
|
||||||
<description>
|
<description>
|
||||||
Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in worldspace.
|
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>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|||||||
Reference in New Issue
Block a user