hi,
I draw lines with “Line2”
I try change colors and try again and again…
but, it always same result black line;
how can i change colors in Line2?
please save me
this is my create and input color script
const positions = [];
// const colors = [];
// const color = new THREE.Color(Math.random() * 1, Math.random() * 1, Math.random() * 1);
var target = new THREE.Vector3(); // create once an reuse it
// ObjectMesh.getWorldPosition( target );
// three.scene.updateMatrixWorld(true);
positions.push(0, 0, 0);
positions.push(ObjectMesh.position.x, ObjectMesh.position.y, ObjectMesh.position.z);
// var point = new THREE.Vector3();
// point.setFromMatrixPosition( ObjectMesh.matrixWorld );
// colors.push(color.r, color.g, color.b);
const geometry = new LineGeometry();
geometry.setPositions( positions );
geometry.setColors( colors );
geometry.setColors( 1,0,0 );
let matLine = new LineMaterial( {
color: 0xffffff,
linewidth: 0.003, // in pixels
vertexColors: true,
//resolution: // to be set by renderer, eventually
dashed: true
})
let _line = new Line2( geometry, matLine );
_line.computeLineDistances();
_line.scale.set( 1, 1, 1 );
return _line;