Lessons : Collision Detection -> Rectangle / Rectangle (Trigonometry)


Welcome to the collision detection page!

See my story page for an explanation of how I made this collision detection in 2004.

Here is the javascript implementation of my collision detection:

collisionDetection.js


Here is an example of it in action. You can drag and resize the rectangles. When you click the "Add Element" button, it will add an element at the coordinates specified which will be on top of the last element you were dragging unless you change the numbers manually.


X: Width:
Y: Height: