How can drag sphere on the sphere

Hello
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 (babylonjs.com)

Check this https://playground.babylonjs.com/#YEZPVT#1563

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 (babylonjs.com)

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:

3 Likes

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

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.

3 Likes