Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

collision detection

$
0
0
I am getting an "expression must have a class type" error with the pBox1 and pBox2 commands. Here is the code I am using.
struct AABB
{
	float xyz1;
	float xyz2;
};

bool CheckCollision(const AABB *pBox1, const AABB *pBox2)
{   
	if(pBox1->xyz1.x > pBox2->xyz2.x) return false;
	if(pBox1->xyz1.y > pBox2->xyz2.y) return false;
	if(pBox1->xyz1.z > pBox2->xyz2.z) return false;
	if(pBox1->xyz2.x < pBox2->xyz1.x) return false;
	if(pBox1->xyz2.y < pBox2->xyz1.y) return false;
	if(pBox1->xyz2.z < pBox2->xyz1.z) return false;
	return true;
}


I will brush up on my oop techniques.

Viewing all articles
Browse latest Browse all 51036

Trending Articles