Rotating PlaneGeometry at edge like a door. using dat.gui?

Oh boy!

Figured it out, i don’t know if it’s a good way of doing it… but this post gave me the solution!

  1. position a mesh ( with PlaneGeomtrey ) a the location i want, after rotation and moving to it’s position.
  2. Next you can access it’s BoundingBox and get 3 corner points from it.
    2.1. ( Don’t forget to convert from localToWorld )
  3. then it’s as simple as plane.setFromCoplanarPoints() !!
///target == the rotated/positioned mesh with PlaneGeometry
target.updateMatrixWorld(true);
target.geometry.computeBoundingBox();
if (target.geometry.boundingBox) {
    const { min: topLeft, max: bottomRight } = target.geometry.boundingBox.clone();
    const bottomLeft = new Vector3(topLeft.x, bottomRight.y, topLeft.z);
    target.localToWorld(topLeft);
    target.localToWorld(bottomLeft);
    target.localToWorld(bottomRight);

    cuttingPlane.setFromCoplanarPoints(topLeft, bottomRight, bottomLeft);
}

I hope this saves someone a lot of time! and if this can be achieved with a better method, i’m all ears :wink:

2 Likes