From 121fd51c4520ddd8cb6fec8c90acb44d0b9d3bc3 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Thu, 23 Jan 2014 08:57:46 +0100 Subject: [PATCH] GL collision with level should worm --- Code/Game/GameLogic/CollisionManager.cpp | 3 +++ Code/Game/GameLogic/Level.cpp | 3 +++ Code/Game/GameLogic/Level.h | 1 + Code/Game/GameLogic/StaticObject.cpp | 5 +++++ Code/Game/GameLogic/StaticObject.h | 1 + 5 files changed, 13 insertions(+) diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index eaafd59a..5be071fe 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -32,6 +32,9 @@ using namespace GameLogic; case OBJECT_TYPE::OBJECT_TYPE_PLAYER: //return Physics::ICustomBody::SubscriptMessage_none; break; + case OBJECT_TYPE::OBJECT_TYPE_WORLD: + int test = 5; + break; } //return Physics::ICustomBody::SubscriptMessage_none; diff --git a/Code/Game/GameLogic/Level.cpp b/Code/Game/GameLogic/Level.cpp index 8335ea8e..bda72073 100644 --- a/Code/Game/GameLogic/Level.cpp +++ b/Code/Game/GameLogic/Level.cpp @@ -26,8 +26,11 @@ void Level::InitiateLevel(float radius) sbDesc.mass = 10e12f; //sbDesc.mass = 0; //10^16 sbDesc.subscription_onCollisionResponse = Level::LevelCollision; + levelObj = new StaticObject(OBJECT_TYPE::OBJECT_TYPE_WORLD); + ICustomBody* rigidBody = API::Instance().CreateRigidBody(sbDesc).Release(); + rigidBody->SetCustomTag(levelObj); API::Instance().AddObject(rigidBody); ICustomBody::State state; rigidBody->GetState(state); diff --git a/Code/Game/GameLogic/Level.h b/Code/Game/GameLogic/Level.h index 71e7ed06..ce299b78 100644 --- a/Code/Game/GameLogic/Level.h +++ b/Code/Game/GameLogic/Level.h @@ -65,6 +65,7 @@ namespace GameLogic Utility::DynamicMemory::DynamicArray> dynamicObjects; GameMode gameMode; Utility::DynamicMemory::SmartPointer rigidBodyLevel; + StaticObject *levelObj; }; diff --git a/Code/Game/GameLogic/StaticObject.cpp b/Code/Game/GameLogic/StaticObject.cpp index 155834fe..03f33e10 100644 --- a/Code/Game/GameLogic/StaticObject.cpp +++ b/Code/Game/GameLogic/StaticObject.cpp @@ -14,6 +14,11 @@ StaticObject::StaticObject(void* collisionFunc, OBJECT_TYPE type) :Object(collisionFunc,type) { +} +StaticObject::StaticObject(OBJECT_TYPE type) + :Object(NULL,type) +{ + } diff --git a/Code/Game/GameLogic/StaticObject.h b/Code/Game/GameLogic/StaticObject.h index 31121447..1a6fd63b 100644 --- a/Code/Game/GameLogic/StaticObject.h +++ b/Code/Game/GameLogic/StaticObject.h @@ -17,6 +17,7 @@ namespace GameLogic public: StaticObject(); StaticObject(void* collisionFunc, OBJECT_TYPE type); + StaticObject(OBJECT_TYPE type); ~StaticObject(void); private: