Hello all,
I am trying to create a very simple tube from a QuadraticBezierCurve. I get an error: “faceless geometries are not supported” and nothing is being rendered. I believe I have followed the example of documentation rigidly enough. Is there anyone who can tell me what I am doing wrong here please?
const config = {
angle: 45, // in degrees
curvature: 0.5, // value between 0 and 1, translates to the Y of bezier control point
radius: 1,
radialSegments: 32,
lengthSegments: 100,
length: 10, // linear distance between start and end points of the curve
color: 0x5E2100,
position: new THREE.Vector3(0, 0, 0)
}
// the lines below translate degrees to radians
const endPointX = Math.cos(config.angle * Math.PI / 180) * config.length;
const endPointY = Math.sin(config.angle * Math.PI / 180) * config.length;
const curve = new THREE.QuadraticBezierCurve(
new THREE.Vector2(0, 0),
new THREE.Vector2(0, config.length * config.curvature),
new THREE.Vector2(endPointX, endPointY)
);
const geometry = new THREE.TubeGeometry(
curve,
config.lengthSegments,
config.radius,
config.radialSegments,
true
);
const material = new THREE.MeshLambertMaterial({color: config.color});
const TubeObject = new THREE.Mesh(geometry, material);
scene.add( TubeObject );
Here’s a codepen where the error is reproduced:
Thank you very much for your kind help!