summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-09 15:53:15 +0100
committerGitHub <noreply@github.com>2020-01-09 15:53:15 +0100
commita0ce88f953a4311edc726523ff8724b891407855 (patch)
tree2e846c4a303e0cd63576d5f765d586b7158f6e6d
parent9fa8d42dd516a2d157449cf78f9095fc21763679 (diff)
parentfdd7cfa820fed8bc7bf6ed769ec71f7af4f91118 (diff)
Merge pull request #34955 from sketchyfun/camera_project_fix
Fixed camera project_position function returning the wrong x & y values
-rw-r--r--scene/3d/camera.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 289dc0ba07..3a30755f7f 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -398,9 +398,9 @@ Vector3 Camera::project_position(const Point2 &p_point, float p_z_depth) const {
CameraMatrix cm;
if (mode == PROJECTION_ORTHOGONAL)
- cm.set_orthogonal(size, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH);
+ cm.set_orthogonal(size, viewport_size.aspect(), p_z_depth, far, keep_aspect == KEEP_WIDTH);
else
- cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH);
+ cm.set_perspective(fov, viewport_size.aspect(), p_z_depth, far, keep_aspect == KEEP_WIDTH);
Size2 vp_size;
cm.get_viewport_size(vp_size.x, vp_size.y);