How can drag sphere on the sphere

How do I scroll the inside sphere over the outer sphere? I shouldn’t be able to drag from the blue area.
Can you help me?

PointerDragBehavior | Babylon.js Playground (

Check this

1 Like

Thanks but I must not be able to drag it from the outside area :).

I couldn’t find any babylonjs feature about it but I solved it with logic. If you let me know if there is a method belonging to babylonjs, I will mark it as a solution.
This is solition:
PointerDragBehavior | Babylon.js Playground (

There are validateDrag callback, but when it returns false the dragging are stopped. As I imagine correct behaviour — the object should take nearest available position without stopping the drag. How to do it I dont know. Probably you should make your own pointerDragBehavior.

pointerDragBehavior.validateDrag = (x) => {
  const distance = BABYLON.Vector3.Distance(x, sphere1.position);
  return distance < 1;
1 Like

You could set isPickable to false on the outer sphere so that it doesn’t block pointer interactions with the inner sphere. :slight_smile:


As I realized, the question is about limitation to drag like Constraints function in the Blender

In ideal world that may works as Guards to modify the Mesh properties :thinking: where you can approve or disolve action by some rules.

1 Like

This is the solution I was looking for :). Thank you.