简体   繁体   中英

How do i correctly set a hole inside a shape in Threejs from an array of Vector3s?

I want to make a shape with a hole in Aframe. Given are the points of the outline of the hole as Vector3s. I can't figure out how to do it correctly.

This is what i tried:

I thought the code should look something like this:

...
    var shape = new THREE.Shape(points);
    shape.holes.push(holepoints);
    var shapeGeom = new THREE.ShapeGeometry(shape);
    var mesh = new THREE.Mesh(shapeGeom, new THREE.MeshBasicMaterial({
      color: "#faaffa",
      side: THREE.DoubleSide,
      wireframe: false
    }));
    mesh.geometry.vertices = xyzpoints;
    scene.object3D.add(mesh);

Unfortunatelly there is no error and the hole doesn't show. Thanks for any help!

This is a workaround hack, not a proper solution, but it might work. Make the interior shape connected to the exterior shape, so that it is all just one shape, and the 'canal' between the interior and exterior shapes has a width of 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM