Topic: [Coding] Check for collision between to points on map?
Hey guys,
I'm trying to check if there is a wall(or some other collision) between to points on the map.
My problem is, that >Hit< stays false in the following code, even if there is a collision between the two points.
My code:
float Dist = pos2distance;
bool Hit;
Hit = false;
for (int i = 1; i < Dist; i += 32)
{
vec2 TestPos = pos1 + normalize(pos2 - pos1 ) * i;
if (Collision()->GetCollisionAt(TestPos.x, TestPos.y)&CCollision::COLFLAG_SOLID)
{
Hit = true;
}
}
Would be great, if somebody can help me with that! Thanks!