No api to disable mesh picking for some buttons and keep onPointerObservable

Pick meshes ONLY with right mouse button
Keep rest onPointerObservalbe functionality (used for rotating camera with mouse wheel)
Right now it’s hard and inconvinient to do this.

API I have:


PointerInfoPre.skipOnPointerObservable fully skips onPointerObservalbe, so camera will not move.

Scene.skipPointerDownPicking enables picking on pointer UP! and there is no convinient way to disable it. Only possibility is to use Scene.pointerDownPredicate (yes, DOWN and not up, Scene.pointerUpPredicate is assigned but never used…). And this is inconvinient and also buggy (works differently on different cameras)

What I tried:
1st PG. Here works on arc camera but not free.
2nd PG. Here I don’t even understand. :frowning:

I tried to look at source and fix it with a PR, but I am really afraid of touching it. Not possible to comprehend whole thing that is going there.

@PolygonalSun could you have a look ?

Lemme take a look and figure out what’s going on.

1 Like

About your title, in the future it would also be better to put a title that describes what exactly you want us to check on the framework :slight_smile: “Not able to pick meshes with onPointerObservable” would have sufficed :slight_smile:

And as a good social rule, if you find yourself having to apologize for something that you just wrote, there’s probably a better way to put it that doesn’t require apologies. I understand everyone gets frustrated sometimes, but we always get further by thinking of everyone else :heart:


Hey I just wanted to update that I’m still looking into this. I’m currently trying to figure out if there’s something about the FreeCamera that’s causing a difference in behavior.

@PolygonalSun Thank you for helping.
My problem is not with a difference in behavior on cameras. I just occasionally found this and in my opinion this is strange. I guess one camera uses onPointerObservable and other do not. Not sure, did not check it.
My GOAL is to use an arc rotate camera with following properties:

  • left mouse button picks mehes (as it does normally)
  • wheel mouse button does not pick meshes
  • wheel mouse button still able to rotate arc rotate camera

I THOUGHT that I just disable picking with Scene.skipPointerDownPicking and do picking meshes myself, BUT this api actually enables picking on pointer up and this is not disalable.

I tried to hack with Scene.pointerDownPredicate but no luck

Yes, you are right, thank you. I actually was frustrated a bit. Changed title.

1 Like

I just had another quick question, is there a reason why you’re trying to stop the internal picking predicates from picking something? The reason why I’m asking is because, unless there’s perf reason, you could probably just use something like this as a workaround in the mean time:

scene.onPointerObservable.add((eventData) => {
    if (eventData.event.button === 0 && eventData.pickInfo.pickedMesh) {
        // If you left click and have a picked mesh, do something
}, BABYLON.PointerEventTypes.POINTERDOWN);

Something like this would allow you to do something when you left click down on a mesh, while preserving movement. It would ignore all other buttons (with respect to picking). If you didn’t want to do it on DOWN, you could change POINTERDOWN to POINTERUP or POINTERPICK.

1 Like

Exactly, there is a perf reason

@PolygonalSun Hello, please, let me know if you are still looking into this problem

Hey @nekochanoide, I am still looking into this. I should be able to devote more time to it this week.

Okay, so here’s what I’ve found. For pointerUpPredicate, it’s being changed and checked for but it’s never actually being used to pick. Not only that but we don’t actually pick with Up, it just pulls the active pick information and send that out (most likely coming from a previous pointerdown pick). I am currently finishing up testing my fix that should do the following. First, I am going to add a boolean to allow the user to skip picking on pointerup. Second, I am going to fix the pointerup code to actually pick on a pointerup using whatever the active pointerUpPredicate is. I should have the PR up later today.

Fix is in PR: InputManager: Fix Picking on PointerUp and add bool to skip pointerup picking by PolygonalSun · Pull Request #12524 · BabylonJS/Babylon.js (


After a few discussions with the team, we figured out the best approach and it’s currently merged into master. skipPointerUpPicking should disable the up picking so you can now completely turn off picking. Also, pointerUpPredicate is now being properly used for up picking.

As a note, changing pointerUpPredicate inside of the onPrePointerObservable will not actually change the picking behavior because, by design, onPrePointerObservable notifies observers after the pick occurs.