From 1079b20e15b1282114fd34244cb121bbb2590d13 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Thu, 20 Feb 2014 11:59:26 +0100 Subject: [PATCH] Updating player pos and RB, moved camera pos for testing --- Code/Game/GameClient/GameClientState/GameState.cpp | 12 +++++++++++- .../Game/GameClient/GameClientState/NetLoadState.cpp | 2 ++ Code/Game/GameLogic/Game_PlayerData.cpp | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Code/Game/GameClient/GameClientState/GameState.cpp b/Code/Game/GameClient/GameClientState/GameState.cpp index 69a37597..d355fc97 100644 --- a/Code/Game/GameClient/GameClientState/GameState.cpp +++ b/Code/Game/GameClient/GameClientState/GameState.cpp @@ -126,6 +126,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa RBData.position = position; RBData.rotation = ArrayToQuaternion( rotation ); RBData.scale = scale; + RBData.type = RB_Type_Cube; // !RB DEBUG if( isMyPlayer ) { @@ -138,7 +139,10 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa this->privData->myId = id; this->privData->camera.SetPosition( this->privData->player.getPos() ); Float3 offset = Float3( 0.0f ); - offset.y = this->privData->player.getScale().y * 0.9f; + // DEBUG position of camera so we can see the player model + offset.y = this->privData->player.getScale().y * 5.0f; + offset.z = this->privData->player.getScale().z * -5.0f; + // !DEBUG this->privData->camera.SetHeadOffset( offset ); this->privData->camera.UpdateOrientation(); } @@ -500,6 +504,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState this->privData->camera.SetRotation( rotation ); this->privData->player.setPos( position ); this->privData->player.setRot( rotation ); + this->privData->player.updateWorld(); + // RB DEBUG + this->privData->player.setRBPos ( position ); + this->privData->player.setRBRot ( rotation ); + this->privData->player.updateRBWorld(); + // !RB DEBUG } C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID]; diff --git a/Code/Game/GameClient/GameClientState/NetLoadState.cpp b/Code/Game/GameClient/GameClientState/NetLoadState.cpp index de4f57d5..9ef0dac9 100644 --- a/Code/Game/GameClient/GameClientState/NetLoadState.cpp +++ b/Code/Game/GameClient/GameClientState/NetLoadState.cpp @@ -157,6 +157,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2; RBData.type = RB_Type_Cube; staticObject->InitRB( RBData ); + staticObject->updateRBWorld(); } if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere) @@ -166,6 +167,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName ) RBData.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2; RBData.type = RB_Type_Sphere; staticObject->InitRB( RBData ); + staticObject->updateRBWorld(); } // !RB DEBUG diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index ed964724..045da742 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -5,7 +5,7 @@ using namespace GameLogic; Game::PlayerData::PlayerData() { - Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0); Oyster::Math::Float height = 2.0f; Oyster::Math::Float radius = 0.5f; Oyster::Math::Float mass = 40; @@ -24,7 +24,7 @@ Game::PlayerData::PlayerData() Game::PlayerData::PlayerData(int playerID,int teamID) { - Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,250,0); + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(-50,180,0); Oyster::Math::Float height = 2.0f; Oyster::Math::Float radius = 0.5f; Oyster::Math::Float mass = 40;