Triangle predicate for picking triggers in ActionManager and PointerDragBehaviour

I would like to set a triangle predicate to be used for picking in ActionManager triggers like ActionManager.OnPickTrigger.

I know this is possible for pointer movement triggers with scene.pointerMoveTrianglePredicate. But I could not find anything similar for picking triggers, neither in the documentation nor in Babylons source.

Here is a playground to show the problem:

Hovering over the top half of the sphere shows an overlay. scene.pointerMoveTrianglePredicate is used here.
Clicking on the sphere changes the overlay color. However, I want this action to also use the triangle predicate.

PointerDragBehaviour also doesn’t seem to support triangle predicates.

Any ideas, how to accomplish this, without getting rid of the ActionManager/PointerDragBehaviour and converting everything to use scene.onPointerObservable with manual scene.pick calls? This would mean huge changes to the code base, I’m working on.

Welcome to the community! In fact, there isn’t a way to pass a triangle predicate to PickTrigger, but the generated ActionEvent contains the pickInfo, so you could check for pickedPoint: Use case for missing pointerClickTrianglePredicate | Babylon.js Playground (


Hey, thanks for the welcome and the reply. :slight_smile:
You’re solution works well for the example in the playground. Though, my actual use case would be picking through culled backfaces, by calculating the triangle normal. So the picking point is not enough.

Would a new member scene.pointerPickTrianglePredicate, which is used for ActionManagers and Behaviours, be a good feature request, maybe? I don’t seem to be the only one missing this functionality (How to Configure Scene.pick Predicate for All Picking Events?).

That could be a new feature indeed, let me tag @PolygonalSun just to check if it makes sense with him


I just issued a PR: Add triangle predicates to pointer down and up events. by f-rooom · Pull Request #14789 · BabylonJS/Babylon.js · GitHub

This would simplify things a lot in our code base. :slight_smile: :crossed_fingers:

1 Like