feat: implement contact listeners

This commit is contained in:
2026-09-02 21:42:49 +02:00
parent 287e5c6885
commit d515a36403
20 changed files with 595 additions and 95 deletions
+10 -3
View File
@@ -18,6 +18,7 @@
#include "destrum/ObjectModel/GameObject.h"
#include "destrum/Util/ModelDoc.h"
#include "destrum/Components/Animator.h"
#include <components/TriggerLoggerComponent.h>
#include <filesystem>
@@ -433,9 +434,15 @@ void LightKeeper::customInit()
sphereMaterial = resources.materials().addSimpleColorMaterial({0.5f, 0.3f, 0.8f}, "Blue");
auto obj = scene.CreateGameObject("GameObject");
auto printComp = obj->AddComponent<PrintComponent>();
printComp->SetMessage("Testing");
// Trigger zone: a static box with a TriggerLoggerComponent.
// Spheres spawned via the "Spawn ball" button fall through it.
auto triggerObj = scene.CreateGameObject("TriggerBox");
auto triggerBox = triggerObj->AddComponent<BoxCollider>(glm::vec3{3.0f, 3.0f, 3.0f});
triggerBox->SetTrigger(true);
auto triggerRb = triggerObj->AddComponent<Rigidbody>();
triggerRb->SetType(RigidbodyType::Static);
triggerObj->AddComponent<TriggerLoggerComponent>();
triggerObj->GetTransform().SetWorldPosition({0.0f, 0.0f, 0.0f});
}