Answer the question
In order to leave comments, you need to log in
How to drag and drop multiple objects with collisions?
I need to do drag'n drop with collisions.
I have two rectangles, one of which is moved by the mouse on the screen.
I need to make it so that when it collides with another rectangle, the following happens:
Depending on the side it collided with, its location was chosen. Let's say rectangle 1 collides with the left side of rectangle 2.
We need to move it to the left so much that it becomes close to rectangle 2, the same should happen with the other sides, while we can also move rectangle 2 with the mouse.
Answer the question
In order to leave comments, you need to log in
You should use paper.js, it can count collisions.
paperjs.org/examples/candy-crash
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question