mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-11 18:08:05 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
30
dPhysics/dpShapeSphere.cpp
Normal file
30
dPhysics/dpShapeSphere.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "dpShapeSphere.h"
|
||||
#include "dpCollisionChecks.h"
|
||||
#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:
|
||||
std::cout << "No collision detection for: " << (int)m_ShapeType << "-to-" << (int)other->GetShapeType() << " collision!" << std::endl;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
Reference in New Issue
Block a user