Skip to content

Commit

Permalink
Merge pull request #34955 from sketchyfun/camera_project_fix
Browse files Browse the repository at this point in the history
Fixed camera project_position function returning the wrong x & y values
  • Loading branch information
akien-mga authored Jan 9, 2020
2 parents 9fa8d42 + fdd7cfa commit a0ce88f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scene/3d/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a0ce88f

Please sign in to comment.