We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

v3d.js:1 v3d.Sprite: “Raycaster.camera” needs to be set in order to raycast against sprites.

Home Forums Programming v3d.js:1 v3d.Sprite: “Raycaster.camera” needs to be set in order to raycast against sprites.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #77580
    derekwang0605
    Customer

    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);

    • This topic was modified 3 hours, 5 minutes ago by derekwang0605.
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.