Question

So i've been using trackball controls, and as of lately i've noticed a weird bug dare i say. If you pan and then zoom out of your new position the controls start acting very oddly, pulling the the direction of the origin (the greater the pan the more significant the issue).

I put together a fiddle which demonstrates the issue. Simply pan away from the ball (right click + mouse move). Then zoom out.

I'm not 100% sure its not my fault, but i feel as if this example is quite simple and foolproof.

Here are some settings i have enabled:

var controls = new THREE.TrackballControls(this.camera, this.renderer.domElement);
var radius = 14;// scalar value used to determine relative zoom distances
controls.rotateSpeed = 1;
controls.zoomSpeed = 1.2;
controls.panSpeed = 1;

controls.noZoom = false;
controls.noPan = false;

controls.staticMoving = false;
controls.dynamicDampingFactor = 0.3;

controls.minDistance = radius * 1.1;
controls.maxDistance = radius * 25;

controls.keys = [ 65, 83, 68 ]; // [ rotateKey, zoomKey, panKey ]
Was it helpful?

Solution

  1. Trackball controls is part of the examples, not the library, so you are free to hack at it.

  2. I think what is happening is that the "zooming out after panning" works fine until you hit the maximum distance -- then the camera "slides around".

  3. You may be able to see this more clearly in this updated fiddle, which shows the inner and outer spheres: http://jsfiddle.net/z52dP/1/

  4. If you think you can improve the code, please post a suggestion at the three.js github site.

three.js r.54

.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top