Hi, I want to implement a 3d object that moves in the xz plane and can’t go beyond it, here’s my demo, please help me point out how I should implement this requirement.
Also, the problem with this demo so far is that it only changes the position of the object when the mouse is released, what I want is to change the position of the object when the mouse is moved.
Not familiar with things about behavior so I computed it directly.
1 Like
Hello, and welcome !
You can use the validateDrag function
"Doc : Predicate to determine if it is valid to move the object to a new position when it is moved"
Also, if you want to keep dragging farer that the limit, but still have the box stick at the limit, you can work with clones :
1 Like
Thank you very much for resolving my problem. It really works for me.
I’m new to Babylon.js. This is very helpful in giving me a lot of ideas! Thank you very much!
According to my own needs, refer to @Tricotou’s ideas, completed the version of the demo without bugs. attached address, encounter the same problem of friends can refer to. Thanks again!
1 Like