@Hermann-SW You are not alone! I had the same experience, back in March.
Latest posts made by settinger
A camera without gimbal lock
Hi all, I'm still learning the ins and outs of JSCAD but enjoying it thus far. Please forgive me if I'm misunderstanding the project structure or purpose here; I would quite like to understand it better.
Is the regl-renderer core package the only "official" way to render and interact with JSCAD models on a webpage? Is there any documentation for it? I don't see any with the rest of the documentation. The regl-renderer camera annoys me quite a bit. I want to move the camera freely around my scene without locking up at the looking-straight-down or looking-straight-up positions. I can understand if not everyone wants this all the time, but it seems like a useful option one can enable, and it's in line with the camera motion in every other piece of modeling software I've seen.
Poking around in the code, it looks like the camera view is a gl-mat4 object calculated using just two spherical coordinate angles, theta and phi. Once the desired camera position is computed, it's turned into a mat4 object using the lookAt() function, which is what's limiting the camera's range of motion. Actually, it looks like it does the lookAt() function twice--once in orbitControls.js and once in the ortho or perspective camera code.
The first thing that comes to my mind is to use gl-quat, and instead of just computing mat4.lookAt() at the new camera position, to use quat.rotationTo() based on the old and new positions. But this would involve changing the structure of the camera view, and require different info to be passed in the camera state, so I don't know how feasible it would be to switch between one camera mode and the other. I have a vague sense of how to implement this, but not enough to work on a pull request. I'm interested to hear others' thoughts on the camera.