91
General / Re: Constraining movement of a draggable object
« on: July 25, 2013, 01:53:43 am »
The original code is still there. The balls are draggable and there's collision detection between them.
Here is a basic implementation of Nexus' suggestion, with a bit of help from his library Thor. I discounted his advice on moving on discrete points though and instead project the direction vector onto the edge.
There's no guard against moving off the ends of edges.
Whether these constitute good tutorials, I really doubt.
Here is a basic implementation of Nexus' suggestion, with a bit of help from his library Thor. I discounted his advice on moving on discrete points though and instead project the direction vector onto the edge.
There's no guard against moving off the ends of edges.
Whether these constitute good tutorials, I really doubt.