I'm trying to create lines with a dashed pattern, but somehow the material isn't reflected on the line I'm creating and I just can't see what I'm doing wrong here...
I'm using code from this example, which should produce this:
When I take the following code:
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0,0,0));
geometry.vertices.push(new THREE.Vector3(100,0,0));
var material = new THREE.LineDashedMaterial({ color: 0xffaa00, dashSize: 3, gapSize: 1, linewidth: 2 });
var mesh = new THREE.Line(geometry, material);
scene.add(mesh);
This is what I get:
Any hint would be appreciated!
geometry.computeLineDistances();
http://threejs.org/docs/#api/core/Geometry
.lineDistances
An array containing distances between vertices for Line geometries. This is required for LinePieces/LineDashedMaterial to render correctly. Line distances can also be generated with computeLineDistances.
Geometry.computeLineDistances()
has been deprecated, so Derte Trdelnik's answer can not work now.
Use Line.computeLineDistances()
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With