refactor: detection collision
refactor: + Collision pour tout les objets, les objets differents d'une sphere seront traites comme des cubes
This commit is contained in:
parent
51771906ce
commit
a8d9543c29
@ -7,7 +7,7 @@ Pos=1139,42
|
|||||||
Size=392,214
|
Size=392,214
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
Pos=53,55
|
Pos=20,556
|
||||||
Size=637,299
|
Size=637,299
|
||||||
|
|
||||||
[Window][Terrain]
|
[Window][Terrain]
|
||||||
|
@ -83,14 +83,6 @@ bool Physics::IsColliding(Object* object1, Object* object2)
|
|||||||
std::string type1 = object1->GetName();
|
std::string type1 = object1->GetName();
|
||||||
std::string type2 = object2->GetName();
|
std::string type2 = object2->GetName();
|
||||||
|
|
||||||
// Treat "plane" objects as "cube"
|
|
||||||
if (type1 == "plane") type1 = "cube";
|
|
||||||
if (type2 == "plane") type2 = "cube";
|
|
||||||
|
|
||||||
if (type1 == "cube" && type2 == "cube")
|
|
||||||
{
|
|
||||||
return CubesOverlap(object1, object2);
|
|
||||||
}
|
|
||||||
if (type1 == "sphere" && type2 == "sphere")
|
if (type1 == "sphere" && type2 == "sphere")
|
||||||
{
|
{
|
||||||
return SpheresOverlap(object1, object2);
|
return SpheresOverlap(object1, object2);
|
||||||
@ -106,6 +98,10 @@ bool Physics::IsColliding(Object* object1, Object* object2)
|
|||||||
return SphereCubeOverlap(object2, object1);
|
return SphereCubeOverlap(object2, object1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return CubesOverlap(object1, object2);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user