Skip to content

Commit

Permalink
Fix Camera3D::project_ray_origin for PROJECTION_FRUSTUM
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmpinc committed Apr 8, 2023
1 parent edca8fe commit 331f17d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scene/3d/camera_3d.cpp
Expand Up @@ -324,9 +324,7 @@ Vector3 Camera3D::project_ray_origin(const Point2 &p_pos) const {
Vector2 cpos = get_viewport()->get_camera_coords(p_pos);
ERR_FAIL_COND_V(viewport_size.y == 0, Vector3());

if (mode == PROJECTION_PERSPECTIVE) {
return get_camera_transform().origin;
} else {
if (mode == PROJECTION_ORTHOGONAL) {
Vector2 pos = cpos / viewport_size;
real_t vsize, hsize;
if (keep_aspect == KEEP_WIDTH) {
Expand All @@ -343,6 +341,8 @@ Vector3 Camera3D::project_ray_origin(const Point2 &p_pos) const {
ray.z = -near;
ray = get_camera_transform().xform(ray);
return ray;
} else {
return get_camera_transform().origin;
};
};

Expand Down

0 comments on commit 331f17d

Please sign in to comment.