restrict size of world three.js and orbitcontrols.js

Viewed 261

I have created a plane geometry within the world and I have looked into the orbit controls library and I have restricted some controls with controls.maxPolarAngle = Math.PI / 2; and controls.enableRotate = false; which is all good. However, I can't see to find an option to restrict panning as I want the pan to stop at the parameters of the plane geometry so it stays within the plane if that makes sense. Because if I continue to pan it goes on forever. I have tried maxDistance and minDistance, but to no avail. Maybe I need to clamp the camera position between certain values?..but I don't know how to do this.

0 Answers
Related