fitToBox on a plane: how to prevent plane to get perpendicular to view?
AmauryHamon opened this issue · comments
Describe the bug
Hi all, just discovering cameraControls.
I made a scene with planes positioned and rotated randomly
When clicking on a plane, I want to fit the plane intersected to fit only on its front or back side.
If the plane is rotated close to being perpendicular to the view, then it choose 'invisible sides'
Is there anything to prevent that?
To Reproduce
Steps to reproduce the behavior:
- Create a scene with a plane
- add mouse raycaster and click event to call the fitToBox on the intersected plane
- Move camera so plane is rotated close to being perpendicular to camera
- See error
Code
No response
Live example
Expected behavior
If mesh is a plane, only fit to front side (or back if double side is activated)
Screenshots or Video
No response
Device
Desktop
OS
MacOS
Browser
Chrome
Did you already check https://yomotsu.github.io/camera-controls/examples/fit-to-rect.html ?