BufferGeometry().fromGeometry is not defined.
As asked here-
https://discourse.threejs.org/t/why-i-cant-create-face3-in-threejs-typescript-project/26780
I can’t access the fromGeometry
function because it is not exists any more.
I’m a little confuse, becauase all the related answers said to switch from Geomtry to BufferGeometry(), which I did.
But no one mention what to do with this missing function.
Currentlly the Face3 is still in use in my code from ‘three/examples/jsm/deprecated/Geometry.js’;
__generateEdgePlane(interior = true, plane = null) {
let geometry = new Geometry(); let v1 = null; let v2 = null; if (interior) { v1 = this.transformCorner(this.interiorEnd()); v2 = this.transformCorner(this.interiorStart()); } else { v1 = this.transformCorner(this.exteriorStart()); v2 = this.transformCorner(this.exteriorEnd()); } let v3 = v2.clone(); let v4 = v1.clone(); let ab = null; let ac = null; // v3.y = this.wall.height; // v4.y = this.wall.height; v3.y = this.wall.startElevation; v4.y = this.wall.endElevation; ab = v2.clone().sub(v1); ac = v3.clone().sub(v1); this.__vertices = [v1, v2, v3, v4]; this.__normal = ab.cross(ac).normalize().negate(); this.__mathPlane = new Plane(); this.__mathPlane.setFromNormalAndCoplanarPoint(this.__normal.clone(), this.__vertices[0].clone()); geometry.vertices = [v1, v2, v3, v4]; // geometry.faces.push(new Face3(0, 1, 2)); // geometry.faces.push(new Face3(0, 2, 3)); geometry.faces.push(new Face3(2, 1, 0)); geometry.faces.push(new Face3(3, 2, 0)); geometry.computeFaceNormals(); geometry.computeBoundingBox(); if (!plane) { plane = new Mesh(**new BufferGeometry().fromGeometry(geometry)**, new MeshBasicMaterial({ visible: true })); } else { plane.geometry.dispose(); plane.geometry = new BufferGeometry().fromGeometry(geometry); //this.__plane.geometry.fromGeometry(geometry); } //The below line was originally setting the plane visibility to false //Now its setting visibility to true. This is necessary to be detected //with the raycaster objects to click walls and floors. plane.visible = true; plane.edge = this; // js monkey patch plane.wall = this.wall; plane.geometry.computeBoundingBox(); plane.geometry.computeFaceNormals(); this.computeTransforms(this.interiorTransform, this.invInteriorTransform, this.interiorStart(), this.interiorEnd()); this.computeTransforms(this.exteriorTransform, this.invExteriorTransform, this.exteriorStart(), this.exteriorEnd()); let b3 = new Box3(); b3.setFromObject(plane); this.min = b3.min.clone(); this.max = b3.max.clone(); this.center = this.max.clone().sub(this.min).multiplyScalar(0.5).add(this.min); return plane; }