Skip to content

Sprite.raycast exception, Raycaster._camera is undefiend #17078

@Usnul

Description

@Usnul
Description of the problem

When trying to get intersections with a Sprite using a Raycaster like so:

const raycaster = new Raycaster(source, target, 0, Infinity);

const intersection = [];

leaf.object.raycast(raycaster, intersection);

This gets thrown:
TypeError: Cannot read property 'matrixWorld' of undefined

culprit:

viewWorldMatrix.copy( raycaster._camera.matrixWorld );

the issue is that a _camera object is somehow expected where there is none. Looks like this was introduced originally in here:
2fda472#diff-cf59543b9c35550d3d4f19faa7f3b4a5

Three.js version
  • r106
Browser
  • Chrome
OS
  • Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions