pex-gl / pex-cam

Cameras models and controllers for 3D rendering in PEX.
MIT License
2 stars 3 forks source link

Arcball breaks if we come to close to 0,0,0 #1

Closed vorg closed 6 years ago

automat commented 8 years ago

Actually this is happening:

Mat4.lookAt([0.0000001,0.0000001,0.0000001],[0,0,0],[0,1,0]);

//returns
// [ 1, 0, 0, 0, 
//   0, 1, 0, 0, 
//   0, 0, 1, 0, 
//   0, 0, 0, 1 ]
vorg commented 8 years ago

Right, my old code didn't that check for Math.abs(eyex - targetx) < 0.000001. Also because we have inertia when we scroll at some point Arcball just 'snaps' to 0,0,0.

I would propose that we change Arcball.js#L85:

this._distanceMin = Number.MIN_VALUE; to 2 * EPSILON