Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I can't create Face3 in ThreeJS Typescript project

I am trying to create Mesh by using Face3. I am using Threejs in typescript project. There are several problems I am facing.

const points = [
     new Face3(-1, 1, -1),//c
     new Face3(-1, -1, 1),//b
     new Face3(1, 1, 1),//a

     new Face3(1, 1, 1),//a
     new Face3(1, -1, -1),//d
     new Face3(-1, 1, -1),//c

     new Face3(-1, -1, 1),//b
     new Face3(1, -1, -1),//d
     new Face3(1, 1, 1),//a

     new Face3(-1, 1, -1),//c
     new Face3(1, -1, -1),//d
     new Face3(-1, -1, 1),//b
]
let geometry = new Geometry();
for (const point of points) {
     geometry.faces.push(point);
}

First of all, I can't add this geometry into mesh. It gives me error that it is not a BufferGeometry

enter image description here

If I try to create a new BufferGeometry from Geomtery, I can't find property fromGeometry

enter image description here

If these kind of functions has been deprecated, then what is the exact alternative for this? Why there is no proper guideline or instruction available? Is there anyone who can suggest me better solution.

like image 652
USMANHEART Avatar asked Oct 24 '25 11:10

USMANHEART


1 Answers

The class THREE.Geometry has been removed form core since r125 and was moved to examples/jsm/deprecated/Geometry.js. THREE.Face can be imported from the same module.

Notice that it is not recommended to work with THREE.Geometry anymore. It's best to focus on THREE.BufferGeometry. The following topic at the three.js forum provides more background information: https://discourse.threejs.org/t/three-geometry-will-be-removed-from-core-with-r125/22401

like image 66
Mugen87 Avatar answered Oct 27 '25 01:10

Mugen87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!