# Detecting collision between 2 rotated rectangles with limited parameters

Are there any function that can detect collisions between 2 rotated rectangles in javascript with this kind of information:

r1 = {x:0,y:0,w:2,h:2,transformX:5,transformY:Y,rot:30}
r2 = {x:1,y:1,w:2,h:2,transformX:5,transformY:Y,rot:30}
//rot is degrees
function rectColliding(rect1,rect2){
//Code
}

console.log(rectColliding(r1,r2))

• Google "2D OBB Intersection". OBB is Oriented Bounding Box which is an arbitrarily rotated rectangle. – user2927848 May 16 at 20:21
• I get x, y, w, and h, but what does transformX and transformY mean? – mackycheese21 May 16 at 22:00
• @mackycheese21 The origin of rotation. I'm using Javascript Transform and rotate, dont forget. – Noah Gerard May 17 at 10:27
• @user2927848 I've seen that before, and I would very much liek to try it, but I dont know how to gte the vertecies of a roated angle. – Noah Gerard May 17 at 10:34
• Then search/ask how to get the vertices after rotating by that angle. This is just highschool math, not an insurmountable barrier. – DMGregory Jun 16 at 13:38