@@ -298,7 +298,7 @@ PhysicsWorld::PhysicsWorld(entt::registry ®istry) {
298
298
physicsSystem->OptimizeBroadPhase ();
299
299
bodyInterface = &physicsSystem->GetBodyInterface ();
300
300
301
- debugRenderer = std::make_unique< PhysicsDebugDrawer> ();
301
+ debugRenderer = new PhysicsDebugDrawer ();
302
302
// Setup up destructors for components
303
303
registry.on_destroy <PhysicsBody>().connect <&PhysicsWorld::onPhysicsBodyDestroyed>(this );
304
304
registry.on_destroy <CarPhysics>().connect <&PhysicsWorld::onCarPhysicsDestroyed>(this );
@@ -324,6 +324,7 @@ void PhysicsWorld::onCarPhysicsDestroyed(entt::registry ®istry, entt::entity
324
324
}
325
325
326
326
PhysicsWorld::~PhysicsWorld () {
327
+ delete debugRenderer;
327
328
for (auto id : bodies) {
328
329
bodyInterface->RemoveBody (id);
329
330
bodyInterface->DestroyBody (id);
@@ -640,12 +641,12 @@ void PhysicsWorld::rayPick(glm::vec3 origin, glm::vec3 direction, float maxDista
640
641
641
642
std::vector<std::pair<glm::vec3, glm::vec3>> PhysicsWorld::debugDraw () {
642
643
#ifdef JPH_DEBUG_RENDERER
643
- ((PhysicsDebugDrawer *)debugRenderer. get () )->clear ();
644
+ ((PhysicsDebugDrawer *)debugRenderer)->clear ();
644
645
BodyManager::DrawSettings settings;
645
646
settings.mDrawBoundingBox = false ;
646
647
settings.mDrawVelocity = true ;
647
- physicsSystem->DrawBodies (settings, debugRenderer. get () );
648
- return ((PhysicsDebugDrawer *)debugRenderer. get () )->lines ();
648
+ physicsSystem->DrawBodies (settings, debugRenderer);
649
+ return ((PhysicsDebugDrawer *)debugRenderer)->lines ();
649
650
#else
650
651
return {};
651
652
#endif
0 commit comments