2021-12-05 17:54:36 +00:00
|
|
|
#include "dpShapeSphere.h"
|
|
|
|
#include "dpCollisionChecks.h"
|
2023-11-22 02:04:23 +00:00
|
|
|
#include "Game.h"
|
|
|
|
#include "Logger.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
dpShapeSphere::dpShapeSphere(dpEntity* parentEntity, float radius) :
|
|
|
|
dpShapeBase(parentEntity),
|
|
|
|
m_Radius(radius) {
|
|
|
|
m_ShapeType = dpShapeType::Sphere;
|
|
|
|
}
|
|
|
|
|
|
|
|
dpShapeSphere::~dpShapeSphere() {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool dpShapeSphere::IsColliding(dpShapeBase* other) {
|
|
|
|
if (!other) return false;
|
|
|
|
|
|
|
|
switch (other->GetShapeType()) {
|
|
|
|
case dpShapeType::Sphere:
|
|
|
|
return dpCollisionChecks::CheckSpheres(m_ParentEntity, other->GetParentEntity());
|
|
|
|
|
|
|
|
case dpShapeType::Box:
|
|
|
|
return dpCollisionChecks::CheckSphereBox(m_ParentEntity, other->GetParentEntity());
|
|
|
|
|
|
|
|
default:
|
2023-11-22 02:04:23 +00:00
|
|
|
LOG("No collision detection for: %i-to-%i collision!", static_cast<int32_t>(m_ShapeType), static_cast<int32_t>(other->GetShapeType()));
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|