Want to make draggable objects don’t pass some defined boundaries. I’m using collision detection with boundraies but it just passses while dragging.
Hi! Collision detection won’t help you here. The easiest thing is editing the code that you’re using to drag things around the screen. Can we see your code?
I can’t download on this PC but if you can find the on_input code, you need to add an if statement there limiting the X position. If you can find and share that code (copy and paste it here), I can have a look at it for you very quickly.
I will try one more attempt to solve this as you suggested. If I can’t then I will share code here.
Thanks its working as expected. Did limited object X position as you suggested in its update funtion where I’m setting game object position.
Well done! Unless you’re working with realistic physics, you don’t need collision objects.
If you ever need to drag physics simulated collision objects, then i find it best to drag a kinematic “handle” that has a joint connected to the object to be dragged. Sort of like a rubber band. Then if the user tries to drag the main object through a wall, it does not go through the wall.
I am new to defold though so maybe defold has a better way.