Thanks for your replies guys. Let me clarify!
What I want to achieve is very similar to this Babylon.js Playground from this thread PointerDragBehavior with collision (pinging @timetocode @trevordev)
The difference is that I don’t want to drag the mesh, I want the mesh to follow the mouse, unless it hits another mesh. If the mesh hits a wall, then it should be able to wall slide like the example above.
Instead of using
scene.onPointerMove
I am now using
scene.onPointerObservable.add((pointerInfo)
Example: https://www.babylonjs-playground.com/#JDXFPE#2
My problem now, is that I dont know what delta is (?). Can I get it from pointerInfo
?
sphere.position.x -= event.delta.x
Also, now that I am using onPointerObservable
, is there a better way to get the mousePointer location instead of using scene.pick(scene.pointerX, scene.pointerY)
?
In conclusion, I will have a bunch of tubes on the ground and I want to make sure that the box does NOT go through them.
I hope this makes things clearer.