well I am trying to get a bullet to hit an enemy ship and destroy it. I am having trouble getting the collision float x_two values and y_two values to be correct. here is my code
glBegin(GL_LINE_LOOP);
float offsets[4][2] = { {0.0f, 0.0f}, {-5.0f, -5.0f}, {0.0f, 10.0f}, {5.0f, -5.0f} };
float cosA = cos(shipenemyAngle);
float sinA = sin(shipenemyAngle);
for (int i = 0; i < 4; i++)
glVertex3f(offsets[i][0] * cosA - offsets[i][1] * sinA, offsets[i][0] * sinA + offsets[i][1] * cosA, 0.0f);
glEnd();
void coll_ship_one()
{
//draw bullet
float x = (0.0f * cos(shipAngle) - 10.0f * sin(shipAngle)*up);
float y = (0.0f * sin(shipAngle) + 10.0f * cos(shipAngle)*up);
float oWidth=2.0f;
float oHeight=2.0f;
//draw ship
float xTwo=10.0f;
float yTwo=0.0f;
float oTwoWidth= 10.0f;
float oTwoHeight=15.0f;
if (checkCollide(x, y, oWidth, oHeight, xTwo, yTwo, oTwoWidth, oTwoHeight) == 1)
{
exit(0);
}
}