diff --git a/Code/Game/DanBiasServer/ServerObjects/GameSession.cpp b/Code/Game/DanBiasServer/ServerObjects/GameSession.cpp index e8896878..8a5f54e5 100644 --- a/Code/Game/DanBiasServer/ServerObjects/GameSession.cpp +++ b/Code/Game/DanBiasServer/ServerObjects/GameSession.cpp @@ -143,9 +143,25 @@ using namespace GameLogic; void GameSession::EricLogicInitFunc() { - //CollisionManager::BoxCollision(0,0); + CollisionManager::BoxCollision(0,0); + + objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX); + + Protocol_CreateObject objectCreation; + objectCreation.object_ID = objectBox->GetID(); + objectCreation.path = "crate"; + Oyster::Math::Float4x4 worldMat = objectBox->GetRigidBody()->GetOrientation(); + + for (int i = 0; i < 16; i++) + { + objectCreation.worldMatrix[i] = worldMat[i]; + } + + for (int i = 0; i < clients.Size(); i++) + { + clients[i]->NetClient_Object()->Send(objectCreation); + } - //objectBox = new DynamicObject(CollisionManager::BoxCollision, OBJECT_TYPE::OBJECT_TYPE_BOX); } void GameSession::EricLogicFrameFunc() { @@ -153,13 +169,31 @@ using namespace GameLogic; } void GameSession::EricsLogicTestingProtocalRecieved(ClientObject* reciever, CustomNetProtocol& protocol) { - + bool moved = false; switch (protocol[protocol_ID_INDEX].value.netShort) { case protocol_Gameplay_PlayerNavigation: ConvertToMovement(reciever, protocol); + moved = true; break; } + + if (moved) + { + + Protocol_ObjectPosition playerMovement; + + Oyster::Math::Float4x4 worldMat = reciever->Logic_Object()->GetRigidBody()->GetOrientation(); + playerMovement.object_ID = reciever->Logic_Object()->GetID(); + for (int i = 0; i < 16; i++) + { + playerMovement.worldMatrix[i] = worldMat[i]; + } + + reciever->NetClient_Object()->Send(playerMovement); + } + + } diff --git a/Code/Game/GameProtocols/ObjectProtocols.h b/Code/Game/GameProtocols/ObjectProtocols.h index 9cac85be..7ba023b1 100644 --- a/Code/Game/GameProtocols/ObjectProtocols.h +++ b/Code/Game/GameProtocols/ObjectProtocols.h @@ -11,7 +11,7 @@ namespace GameLogic struct Protocol_CreateObject :public Oyster::Network::CustomProtocolObject { int object_ID; - char path[255]; + char *path; float worldMatrix[16]; diff --git a/Code/GamePhysics/PhysicsAPI.h b/Code/GamePhysics/PhysicsAPI.h index 84a3d639..04d0d3f1 100644 --- a/Code/GamePhysics/PhysicsAPI.h +++ b/Code/GamePhysics/PhysicsAPI.h @@ -232,10 +232,12 @@ namespace Oyster protected: virtual ~API() {} }; - + + //! The root interface for all physical representations processable by the engine. class PHYSICS_DLL_USAGE ICustomBody { + public: enum SubscriptMessage {