Hi there , I want to create a sort of match the following game with babylon . But I am encountering a problem with the pointerDragBehavior . The object , cube , starts of okay , but on the second drag down goes even more down and up and down .Please see the playground for reference . The playground I am about to share has a bug which is not there in my editor , it is, a.initFunction in not a function. Please tell me what’s wrong so I can correct it .Thanks.
Hey there, it looks like the issue is that createScene() is called (on line 39). The playground calls this function for us, as well as resizing the engine and providing the render loop to render our scene, so we can comment out or remove these parts when working in the playground, like this.
Edit: that fixes the issue of running the code in the playground, but I’m not sure what the desired dragging behavior is?
Thanks for fixing that , I corrected my playground.Also ,the desired behavior is such that the cube should be dragging on the x axis until 5 or -5 units , and then be able to move up . After the behavior is on the y axis , it should be able to move back on the x axis by coming back to 0 units on the y axis.Should I also post a diagram ?
One approach is to wait until the mesh has been dragged up a small amount before allowing the axis to switch back, and to use a validator to keep it from being dragged too far. IDK thou, if maybe there’s an easier way.