Action manager pointer trigger with bounding box

PG: Babylon.js Playground

Just to explain what’s going on, the PG is a hack for meshes that need bounding box-like picking with action manager. I thought that perhaps its a roundabout way to handle mesh picking since scene.pickWithBoundingInfo exists. I chked with src and it appears that scene.inputManager.ts largely uses scene.pick for all its needs. And the action manager triggers are wrapping around it.

I was thinking something along the lines of:

public _pickMoveWithBoundingInfo(evt: IPointerEvent): PickingInfo {
        const scene = this._scene;
        const pickResult = scene.pickWithBoundingInfo(
            this._unTranslatedPointerX,
            this._unTranslatedPointerY,
            scene.pointerMovePredicate,
            scene.pointerMoveFastCheck,
            scene.cameraToUseForPointers,
            scene.pointerMoveTrianglePredicate
        );

        this._setCursorAndPointerOverMesh(pickResult, evt, scene);

        return pickResult;
    }

And have _pickMoveWithBoundingInfo available to incorporate in the picking flow according to new triggers ACTION_OnPointerOverBoundingInfoTrigger/ACTION_OnPointerOutBoundingInfoTrigger. But it seems like that’s not how the picking flow works…

My question is: with the current architecture, there really is no clean way to incorporate scene.pickWithBoundingInfo and scene.pick in the same scene, is there ?

Hmmmmm, yeah, I’d go with the “fake” box hack instead of trying to mess with the inputManager code :sweat_smile: @PolygonalSun might have some idea about the input manager through?

2 Likes

ok thks, marking as solved. Been a while since I’ve submitted a PR to inputManager but this hack doesn’t impact perf, is sufficiently clean and works for all hollowed out shapes, I guess its not a biggie. Shrugs…