Repository navigation
[Patch] Fix getCameraEye returning a stale position after WASD movement - #1438
Merged
Merged
Conversation
getCameraEye read CameraComponent.eye, a field only ever written by cameraLookAt (orbit/pan/zoom/look). moveCameraWithInput/moveCameraBy/ moveCameraTo (the WASD fly path, built on translateBy/translateTo) correctly update the camera's real position but never touched .eye, so getCameraEye kept returning the pre-move position indefinitely — wrong for any caller using it as a picking-ray origin, even though the camera had visually moved. getCameraEye now reads localPosition, the same ground truth getCameraPosition already uses, so it never diverges from the camera's actual position regardless of which movement path moved it. Fixes #1437
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1437.
getCameraEye(entityId:)returnedCameraComponent.eye, a field only ever written bycameraLookAt(orbit/pan/zoom/look-style camera code). The WASD fly-camera path (moveCameraWithInput→moveCameraBy/moveCameraTo→translateBy/translateTo) correctly updates the camera's real rendered position (LocalTransformComponent.position, mirrored intoCameraComponent.localPosition/.viewSpaceviasyncCameraTransformIfNeeded) but never touched.eye— sogetCameraEyekept returning the pre-move position indefinitely, even though the camera had visually moved.Any caller using
getCameraEyeas a picking-ray origin (raycast selection, ground-plane picks) would silently miss everything after the camera had ever been moved by WASD-style input. Reproduced in this repo'sSandboxdemo and in a sibling app's Gaussian-splat viewport picking.getCameraEyenow returnscameraComponent.localPosition— the same ground truthgetCameraPositionalready uses — so it can never diverge from the camera's actual position regardless of which movement path moved it.Test plan
testGetCameraEyeTracksPositionAfterWASDMovementtoCameraTest.swift: callscameraLookAtthenmoveCameraWithInput, assertsgetCameraEyetracks the camera's real position instead of freezing at the pre-move value.swift test --filter UntoldEngineTests— 1837 tests, 0 failures, no regressions.Sandboxdemo: selected a Gaussian-splat entity, moved the camera with WASD, dragged its gizmo handles — tracking now holds correctly across camera movement/position.