我无法让THREE.LineDashedMaterial
在三个j中正常工作(我使用r73,但刚刚尝试过r74)。改变颜色很好,但破折号似乎不起作用。这是我的例子:
var segmentCount = 200;
var radius = 100;
var geometry = new THREE.Geometry();
var material = new THREE.LineDashedMaterial( { color: 0xff0000, linewidth: 5, dashSize: 1.0, gapSize: 0.5 } ); //new THREE.LineBasicMaterial({ color: 0xFFFFFF, linewidth: 10 });
for (var i = 0; i <= segmentCount; i++) {
var theta = (i / segmentCount) * Math.PI * 2;
geometry.vertices.push(
new THREE.Vector3(
Math.cos(theta) * radius,
Math.sin(theta) * radius,
0));
}
scene.add(new THREE.Line(geometry, material));
我在我的例子中做错了什么,或者这个错误(https://github.com/mrdoob/three.js/issues/6699)仍然是个问题?
答案 0 :(得分:8)
如果您使用THREE.Geometry
和THREE.LineDashedMaterial
创建一行,则需要致电
line.computeLineDistances(); // or lineSegments.computeLineDistances()
让虚线正确渲染。
three.js r.91