ptcrealitylab / vuforia-spatial-toolbox-userinterface

The user interface of the Vuforia Spatial Toolbox
https://spatialtoolbox.vuforia.com
Mozilla Public License 2.0
7 stars 5 forks source link

Fixed GS raycasting cursor jumping around bug + all math functions refactor #760

Closed Steve-KX-RL closed 1 month ago

Steve-KX-RL commented 1 month ago

Old GS raycasting method has a fundamental flaw which makes calculating cursor world position dependent on screen aspect ratio, specifically only accurate when screen is 1:1. Now introducing a new way to get raycast position. We use the camera space depth to compute the offset between camera and raycast position, and converting it back to world space. The result is a smooth & accurate spatial cursor, always at the center of mouse cursor, regardless of the screen aspect ratio.

https://github.com/user-attachments/assets/4642e6dc-e7f5-4b1c-8ce6-7d4f656698a6