Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 03 December 2012 - 03:34 AM

Am gonna provide rectangle on rectangle collision
//X = starting position X
//Y = starting position Y
//W = Width of the rectangle
//H = Height of the rectangle
rec1;//x y w h
rec2;//x y w h
//The way we gonna check collision is
//From left
//From right
//From top
//From bottom
if(rec1.x + rec1.w > rec2.x &&
    rec1.x < rec2.x + rec2.w &amp;&amp;
    rec1.y + rec1.h  > rec2.y &amp;&amp;
    rec1.y < rec2.y + rec2.w )

EDIT::
I have noticed there is a tag for OpenGL? your checking collision in 3D?

#2BaneTrapper

Posted 03 December 2012 - 03:34 AM

Am gonna provide rectangle on rectangle collision
//X = starting position X
//Y = starting position Y
//W = Width of the rectangle
//H = Height of the rectangle
rec1;//x y w h
rec2;//x y w h
//The way we gonna check collision is
//From left
//From right
//From top
//From bottom
if(rec1.x + rec1.w > rec2.x &amp;&amp;
    rec1.x < rec2.x + rec2.w &amp;&amp;
    rec1.y + rec1.h  > rec2.y &amp;&amp;
    rec1.y < rec2.y + rec2.w )

EDIT::
I have noticed there is a tag for OpenGL? your checking collision in 3D?

#1BaneTrapper

Posted 03 December 2012 - 02:55 AM

Am gonna provide rectangle on rectangle collision
//X = starting position X
//Y = starting position Y
//W = Width of the rectangle
//H = Height of the rectangle
rec1;//x y w h
rec2;//x y w h
//The way we gonna check collision is
//From left
//From right
//From top
//From bottom
if(rec1.x + rec1.w > rec2.x &&
    rec1.x < rec2.x + rec2.w &&
    rec1.y + rec1.h  > rec2.y &&
    rec1.y < rec2.y + rec2.w )

PARTNERS