Hello,
I want to disable the left button only when the pointer is over the mesh :
If
- pointer is over the mesh you can only use the middle button to rotate around the model.
- pointer is outside the mesh you can use the left button and the middle button to rotate around the model.
scene.onPointerObservable.add(eventData => {
if(eventData.type === BABYLON.PointerEventTypes.POINTERMOVE) {
let pickInfo = scene.pick(scene.pointerX, scene.pointerY);
if(pickInfo.hit) {
camera.inputs.attached.pointers.buttons = [1];
}
else {
camera.inputs.attached.pointers.buttons = [0, 1];
}
}
});
I made a playground :
It works excepts a strange behavior I notices when you ‘drag’ from outside the mesh to over the mesh the rotation continue even after you release the left button
- Pointer down at |1| and move to |2|
- Pointer up at |2|
- Camera continue to rotate when the pointer move.
- The only way to stop the rotation is to pick once outside the mesh.
I don’t understand where this behavior come from, do I miss something ?