In my 3rd person RPG style environment created in three.js, I am utilizing orbitControls to navigate. The controls effectively target the player object and allow me to rotate around her regardless of her position in the world.
However, I am facing a challenge with maintaining a constant zoom distance while in motion, especially when it is less than the maximum distance set by the maxDist value. Currently, the only workaround I have found is setting the min and max values to be the same. For example, if I set a high maxDistance value such as 5000, the player starts moving away from the camera once in motion until reaching the maxDist limit.
I am hoping to find a way to establish a secondary or temporary maxDist value, like 500, that adjusts dynamically as the player moves, yet still enables zooming out to the original maxDist of 5000 if needed. Has anyone encountered a similar issue or have any suggestions on how to achieve this?
Any insights would be greatly appreciated. Thank you.