After adding line, I get below error message:
[Violation]’requestAnimationFrame’ handler took 56ms
v3d.js:1 v3d.Sprite: “Raycaster.camera” needs to be set in order to raycast against sprites.
Uncaught TypeError: Cannot read properties of null (reading ‘matrixWorld’)
at rc.raycast (v3d.js:1:772400)
at Cl (v3d.js:1:702481)
at Cl (v3d.js:1:702554)
at Cl (v3d.js:1:702554)
at yl.intersectObject (v3d.js:1:702108)
at YC.update (v3d.js:1:1425786)
at ke (v3d.js:1:753789)
at ke (v3d.js:1:754889)
at ke (v3d.js:1:754889)
at zl.render (v3d.js:1:760423)
raycast @ v3d.js:1
Cl @ v3d.js:1
function createDimensionLine(startPoint, endPoint, color = 0x000000) {
const material = new v3d.LineBasicMaterial({ color });
const points = [];
points.push(new v3d.Vector3(startPoint.x, startPoint.y, startPoint.z));
points.push(new v3d.Vector3(endPoint.x, endPoint.y, endPoint.z));
const geometry = new v3d.BufferGeometry().setFromPoints(points);
const line = new v3d.Line(geometry, material);
line.name = “line001”;
return line;
}
const start = new v3d.Vector3(20, 20, 20);
const end = new v3d.Vector3(10, 0, 0);
const dimensionLine = createDimensionLine(start, end);
scene.add(dimensionLine);