yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.

Home Page:https://yomotsu.github.io/camera-controls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. Create a scene with a plane
  2. add mouse raycaster and click event to call the fitToBox on the intersected plane
  3. Move camera so plane is rotated close to being perpendicular to camera
  4. See error

Code

No response

Live example

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