-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix sandbox pan behavior when zoomed close to a large model #17541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix sandbox pan behavior when zoomed close to a large model #17541
Conversation
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
| // Ensure the panning epsilon is always small enough (no bigger than a 10th of the smallest amount | ||
| // of movement the user can cause) so that even when the panningSensibility is very high and the | ||
| // user pans very slowly, we can still get inertia during the pan without it being clamped to 0 too quickly. | ||
| camera._panningEpsilon = Math.min(Epsilon, 1 / camera.panningSensibility / 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe _panningEpsilon shouldn't be an underscore variable or maybe it should also update when panningSensibility is updated.
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/17541/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/17541/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/17541/merge#BCU1XR#0 |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/17541/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/17541/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Devhost visualization test reporter: |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
When zoomed in close to a model, the sandbox code will increase the panning sensitivity so that small mouse motions don't result in large unexpected camera movement. However, if you get very close to a model, the check to see if the inertia should be clamped to zero would start clamping all slow user movement to zero. Then when the user moved slightly faster, all of a sudden it wouldn't hit the clamp, and it would feel like it sped up unexpectedly all of a sudden.
With this fix, we scale the _panningEpsilon along with the panningSensibility, so that Epsilon get smaller when the sensitivity gets very high, allowing for inertia to continue until the movement is a 10th of the minimum distance the user can pan in a single frame.