PRetty good collision detection but there is still some small bug I don't know about
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
#include "display/shader/SimpleTexturedShader.hpp"
|
||||
#include "scene/components/display/Camera.hpp"
|
||||
#include "scene/Scene.hpp"
|
||||
#include "scene/components/physics/3d/Collider3D.hpp"
|
||||
#include "scene/components/physics/3d/CubeCollider.hpp"
|
||||
|
||||
using namespace Dawn;
|
||||
|
||||
@ -140,4 +142,24 @@ void Scene::debugGrid() {
|
||||
line.v0 = glm::vec3(-s, 0, z), line.v1 = glm::vec3(s, 0, z);
|
||||
this->debugLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::debugHitboxes() {
|
||||
auto colliders = this->findComponents<Collider3D>();
|
||||
auto itColliders = colliders.begin();
|
||||
while(itColliders != colliders.end()) {
|
||||
auto c = *itColliders;
|
||||
switch(c->getColliderType()) {
|
||||
case COLLIDER3D_TYPE_CUBE:
|
||||
auto asCube = dynamic_cast<CubeCollider*>(c);
|
||||
this->debugCube((struct SceneDebugCube){
|
||||
.min = asCube->min,
|
||||
.max = asCube->max,
|
||||
.color = COLOR_BLUE,
|
||||
.transform = asCube->transform->getWorldTransform()
|
||||
});
|
||||
break;
|
||||
}
|
||||
++itColliders;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user