Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I construct a hollow cylinder in Three.js

Tags:

three.js

csg

I'm having difficulties constructing a hollow cylinder in Three.js.

Should I go and construct it using CSG or by stitching the vertices together?

like image 529
Louis Haußknecht Avatar asked Aug 06 '12 10:08

Louis Haußknecht


Video Answer


1 Answers

var extrudeSettings = {
    amount : 2,
    steps : 1,
    bevelEnabled: false,
    curveSegments: 8
};

var arcShape = new THREE.Shape();
arcShape.absarc(0, 0, 1, 0, Math.PI * 2, 0, false);

var holePath = new THREE.Path();
holePath.absarc(0, 0, 0.8, 0, Math.PI * 2, true);
arcShape.holes.push(holePath);

var geometry = new THREE.ExtrudeGeometry(arcShape, extrudeSettings);
like image 103
Troller Avatar answered Jan 01 '23 23:01

Troller