Hello everyone! I’m trying to initialize a fat line with LineSegments2
with specific array length for later use, so the array is filled with 0
, here’re how I did it:
import { LineSegmentsGeometry } from "three/examples/jsm/lines/LineSegmentsGeometry";
import { LineSegments2 } from "three/examples/jsm/lines/LineSegments2";
import { LineMaterial } from "three/examples/jsm/lines/LineMaterial";
const points = new Float32Array(4096);
const material = new LineMaterial({
color: 0xffb24f,
linewidth: 0.002,
transparent: true,
opacity: 1,
depthWrite: false
});
const geometry = new LineSegmentsGeometry().setPositions(points);
const line = new LineSegments2(geometry, material);
And if I try to access it after it’s created:
geometry.attributes.position.array.length
It will be 24
no wonder how long the original array is, what happened? Maybe I did something wrong?
Demo here:
BTW, I found this line of code in the repo. Does this means I can’t update the length of LineSegmentsGeometry
?