Mousedown not working on canvas

I am attempting to capture mouse down event on the babylonjs canvas, but it does not seem to be registering: https://playground.babylonjs.com/#327LUE#2.

I have confirmed that this works on a regular canvas: Edit fiddle - JSFiddle - Code Playground

Any recommendations?

We are intercepting the events on our side so you only need to register this:

 scene.onPointerObservable.add((evt) => {
        if (evt.type === BABYLON.PointerEventTypes.POINTERDOWN) {
            console.log("click!")
        }
    })

If you want to know if this is a mouse you can check this:

console.log(evt.event.pointerType)

It will return “mouse” for a mouse :slight_smile:

Interesting. We’ve been using babylonjs for many years and just now encountered this as a problem. We’ll keep that in mind going forward, thank you!

1 Like

adding @amoebachant just in case we changed something recently on that front

I just took a look and don’t see any recent changes which would have stopped mousedown from being raised, and I agree with @Deltakosh that the recommendation is to use onPointerObservable for the canvas Babylon is using. Thanks!