Incorrect event types in onPointerObservable

Look at this playground: Babylon.js Playground
You will need to open console to see the problem.

When you are pressing and releasing single button you will see event type 1 (pointer down) and event type 2 (pointer up) in a console. Here it is working as expected.

But try to hold RMB and click LMB. You will see only two of event type 4 events (which are pointer move). This glitch doesn’t allow me to shot when I am aiming in my simulation.

Of course I have found how to bypass this:

_setScopedFire () {
    this.scopedFire = this.zoomIn && !this.scopedFire;
}

This function changes the flag on each pointer event while we are aiming. This is how we can divide up and down events. But still I think that original behavior is a bug. If this might be fixed then my hack will not be needed.

Thank you!

The events are coming from the system :slight_smile: This is not related to babylonjs. We listen to pointerdown, pointerup and we just bubble up all of that in a convenient observable

https://playground.babylonjs.com/#EWH6H1#3

That’s sad. Looks like my _setScopedFire function is possible solution. But if someone knows something better and more reliable, please let me know.

1 Like

Just found out that it works correctly on BABYLON 5 (checked on 5.14.0 and above). Glad, that some workaround was found and integrated into BABYLON.
So, my workaround is not needed anymore.

1 Like