Three.js虚线圆圈

时间:2016-05-23 02:50:14

标签: javascript three.js

按照虚线的模式,我尝试了这个,但它没有给我一个虚线圆圈(并不令人惊讶)。

var dashMaterial = new THREE.LineDashedMaterial( { color: 0xee6666, dashSize: 0.5, gapSize: 0.5  } ),
circGeom = new THREE.CircleGeometry( 10, 20 );
circGeom.computeLineDistances();
circGeom.vertices.shift();
var circ = new THREE.Line( circGeom, dashMaterial);
scene.add( circ );

如何在Three.js中构建一个虚线圆圈?

1 个答案:

答案 0 :(得分:1)

您必须在移除中心顶点后计算顶点之间的距离:

circGeom.computeLineDistances();
circGeom.vertices.shift();

=>

circGeom.vertices.shift();
circGeom.computeLineDistances();

[https://jsfiddle.net/fs904hon/]