three.js: THREE.Line from THREE.ShapeGeometry is missing a line segment
Not sure but I think this is a bug or I at least expected something else…
I made a fiddle here to demonstrate…
// definition of a shape ( a 40x40 square)
shape = new THREE.Shape();
shape.moveTo( 0, 0 );
shape.lineTo( 40, 0 );
shape.lineTo( 40, 40 );
shape.lineTo( 0, 40 );
shape.lineTo( 0, 0 );
// convert the shape to geometry
var geometry = shape.makeGeometry();
// material
var material = new THREE.LineBasicMaterial( { color: 0xff0000, linewidth: 2 } );
// line
line = new THREE.Line( geometry, material );
scene.add( line );
The last segment seems to be missing…
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 23 (20 by maintainers)
The problem is that
ShapeGeometry
is intended forMesh
. Try to create your lines like this:http://jsfiddle.net/w67tzfhx/1488/
Also see how the lines are created in this example: https://threejs.org/examples/?q=shape#webgl_geometry_shapes