Click or drag to resize

CameraUnprojectPosition Method

Returns the 2D coordinate in the Viewport rectangle that maps to the given 3D point in worldspace.

Note: When using this to position GUI elements over a 3D viewport, use IsPositionBehind(Vector3) to prevent them from appearing if the 3D point is behind the camera:

# This code block is part of a script that inherits from Spatial.
# `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)

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Vector2 UnprojectPosition(
	Vector3 worldPoint
)

Parameters

worldPoint
Type: GodotVector3

[Missing <param name="worldPoint"/> documentation for "M:Godot.Camera.UnprojectPosition(Godot.Vector3)"]

Return Value

Type: Vector2

[Missing <returns> documentation for "M:Godot.Camera.UnprojectPosition(Godot.Vector3)"]

See Also