xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
738 stars 291 forks source link

Improve CameraControl dollying through objects #469

Closed xeolabs closed 4 years ago

xeolabs commented 4 years ago

With CameraControl followPointer set true, it can be hard to dolly through objects with the mouse scroll wheel, and takes a strong push on the wheel to break through.

CameraControl is designed to slow down as we approach an object, but is slowing down too much.

This can be fixed by ensuring that dollying speed in this case does not fall below a given minimum.

Solution

Increase the default value for CameraControl#dollyMinSpeed from 0.01 to 0.06.

If this is not enough, it can be increased further, eg:

viewer.cameraControl.dollyMinSpeed = 0.08;

Experiment with that here: https://xeokit.github.io/xeokit-sdk/examples/#CameraControl_orbit_Duplex

eriadam commented 4 years ago

@xeolabs Thanks for the fix attempt.

Would you have any additional information on what this value would be dependent on? Browser, viewport size, js engine, hardware, model size, number of meshes, so forth?

In other words, how to do we make sure it works for every models we render?

xeolabs commented 4 years ago

I'm not sure yet how to dynamically derive a workable value for this yet. It's possible, just needs thinking.

For now, I would just try to find a general magic value that works for all models, then I'll come back to this for the next release.

xeolabs commented 4 years ago

@eriadam this one's going to need more work. I just found a wall it gets stuck on, so will have a second patch for this in 1.5.2 on Monday.