diff options
author | David Snopek <dsnopek@gmail.com> | 2023-01-23 21:26:38 -0600 |
---|---|---|
committer | David Snopek <dsnopek@gmail.com> | 2023-01-23 21:26:38 -0600 |
commit | 9196c470321860b82640aa5dee1ef89ca6582871 (patch) | |
tree | 69c682d2f06b745eba9f34635f5a8e5a423c055d /modules | |
parent | 28a24639c3c6a95b5b9828f5f02bf0dc2f5ce54b (diff) |
Correctly apply world_scale in WebXR
Diffstat (limited to 'modules')
-rw-r--r-- | modules/webxr/webxr_interface_js.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/modules/webxr/webxr_interface_js.cpp b/modules/webxr/webxr_interface_js.cpp index 8485c62218..97b2eea4d7 100644 --- a/modules/webxr/webxr_interface_js.cpp +++ b/modules/webxr/webxr_interface_js.cpp @@ -347,9 +347,8 @@ Transform3D WebXRInterfaceJS::get_camera_transform() { ERR_FAIL_NULL_V(xr_server, camera_transform); if (initialized) { - float world_scale = xr_server->get_world_scale(); + double world_scale = xr_server->get_world_scale(); - // just scale our origin point of our transform Transform3D _head_transform = head_transform; _head_transform.origin *= world_scale; @@ -372,13 +371,8 @@ Transform3D WebXRInterfaceJS::get_transform_for_view(uint32_t p_view, const Tran Transform3D transform_for_view = _js_matrix_to_transform(js_matrix); - float world_scale = xr_server->get_world_scale(); - // Scale only the center point of our eye transform, so we don't scale the - // distance between the eyes. - Transform3D _head_transform = head_transform; - transform_for_view.origin -= _head_transform.origin; - _head_transform.origin *= world_scale; - transform_for_view.origin += _head_transform.origin; + double world_scale = xr_server->get_world_scale(); + transform_for_view.origin *= world_scale; return p_cam_transform * xr_server->get_reference_frame() * transform_for_view; }; |