Detaching PointerDragBehavior causes undefined exception

If you add a behavior to a mesh and then detach it, you will get an undefined exception.

TypeError: Cannot set properties of undefined (setting 'isNearGrabbable')
    at PointerDragBehavior.detach (:3007/vendors-node_modules_babylonjs_core_index_js-node_modules_babylonjs_gui_index_js-node_modules-cf9bda.js:12289:43)
    at Mesh.Node.dispose (:3007/vendors-node_modules_babylonjs_core_index_js-node_modules_babylonjs_gui_index_js-node_modules-cf9bda.js:241049:22)

I think the problem is here Babylon.js/pointerDragBehavior.ts at master · BabylonJS/Babylon.js · GitHub, and should maybe check if there is a node attached first?

Playground here:

Adding @Cedric

I ll fix this one, as I owe @Cedric a lot :slight_smile: and I ll push it with other fixes I am doing today.


will be fixed by few fixes by sebavan · Pull Request #12153 · BabylonJS/Babylon.js · GitHub

1 Like