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 4 posts - 1 through 4 (of 4 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);

    #77602

    Hi derekwang0605,

    Thank you for posting this error. We’ll take a look.

    Chief 3D Verger | LinkedIn | Twitter

    #77781

    The crash will be fixed in the upcoming Verge3D preview, however the Sprite objects require setting Raycaster.camera which might not be done for all raycasters used by puzzles.

    If you absolutely need this feature (sprites + raycasting), create custom-made raycasters with JavaScript.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #78237

    Fixed!

    Soft8Soft Tech Chief
    X | FB | LinkedIn

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.