Category : collision-detection

I want to do collision detection in 3d opengl in C++. I have created bounding box and calculated the centre of objects. Now I wanted to apply same transformations for this centre point, same as for whole models. I created functions which return transformed point based on article Matrix-vector multiplication. For example, when I have: ..

Read more

I am trying to make my moving rectangle bounce off the window borders when it collides with them, however the rectangle is rotating. I’m not sure how to define my collision functions, this is what I came up with: //left border collision if(rectangle.getPosition().y<0){ rectangle.setPosition(rectangle.getPosition().x,0); //top border collision }; if(rectangle.getPosition().x<0){ rectangle.setPosition(0,rectangle.getPosition().y); }; //right border collision if(rectangle.getPosition().y+rectangle.getGlobalBounds().width>WINDOW_W){ ..

Read more