TS2339: Property 'pickSpriteWithRay' does not exist on type 'Scene' - ES6 tree shaking


Using ES6 tree shaking, I keep getting the error:
TS2339: Property ‘pickSpriteWithRay’ does not exist on type ‘Scene’.

I’ve imported ray etc., and the pickWithRay function does not throw an error.
I think this is a bug? I’ve tried importing things like scene helper, but none of it worked…

You will need to impor the Ray class (from the Culling) directory to add the side-effects needed and have this function defined. see here:

Thanks for the info, but I’ve read the documentation and I can’t figure out what else to import.
I am importing ray:

import { Ray } from ‘@babylonjs/core/Culling/ray’;

also tried:
import ‘@babylonjs/core/Culling’;
which does not get rid of the error…

Looking at: Babylon.js/ray.ts at master · BabylonJS/Babylon.js · GitHub
I don’t see pickSpriteWithRay being set on the scene, yet pickWithRay is present?

I think you need also something like:

import "@babylonjs/core/Culling/ray";

[EDIT] Maybe it’s this one you are missing:

import "@babylonjs/core/Sprites/spriteSceneComponent";

Ah import “@babylonjs/core/Sprites/spriteSceneComponent”; did the trick, thank you!