Physic rebuild start

This commit is contained in:
2025-01-15 18:33:02 +01:00
parent 58cafd7682
commit c707e49561
6 changed files with 188 additions and 116 deletions

View File

@@ -79,21 +79,26 @@ void Physics::AddForce(Object* object, XMVECTOR force)
bool Physics::IsColliding(Object* object1, Object* object2)
{
ObjectType type1 = object1->GetType();
ObjectType type2 = object2->GetType();
std::string type1 = object1->GetName();
std::string type2 = object2->GetName();
if (type1 == "sphere" && type2 == "sphere")
{
return SpheresOverlap(object1, object2);
if (type1 == ObjectType::Unknown || type2 == ObjectType::Unknown)
{
return false;
}
if (type1 == "cube" && type2 == "sphere" || (type1 == "sphere" && type2 == "cube"))
if (type1 == ObjectType::Sphere && type2 == ObjectType::Sphere)
{
if (type1 == "cube")
return SpheresOverlap(object1, object2);
}
if ((type1 == ObjectType::Cube && type2 == ObjectType::Sphere) ||
(type1 == ObjectType::Sphere && type2 == ObjectType::Cube))
{
if (type1 == ObjectType::Cube)
{
return SphereCubeOverlap(object1, object2);
}
else if (type1 == "sphere")
}
else if (type1 == ObjectType::Sphere)
{
return SphereCubeOverlap(object2, object1);
}
@@ -106,6 +111,7 @@ bool Physics::IsColliding(Object* object1, Object* object2)
return false;
}
/////////////////////////////////////////
// AABB method for collision detection //
/////////////////////////////////////////