Updating player pos and RB, moved camera pos for testing

This commit is contained in:
lindaandersson 2014-02-20 11:59:26 +01:00
parent 84d2c4eb56
commit 1079b20e15
3 changed files with 15 additions and 3 deletions

View File

@ -126,6 +126,7 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
RBData.position = position; RBData.position = position;
RBData.rotation = ArrayToQuaternion( rotation ); RBData.rotation = ArrayToQuaternion( rotation );
RBData.scale = scale; RBData.scale = scale;
RBData.type = RB_Type_Cube;
// !RB DEBUG // !RB DEBUG
if( isMyPlayer ) if( isMyPlayer )
{ {
@ -138,7 +139,10 @@ void GameState::InitiatePlayer( int id, const std::string &modelName, const floa
this->privData->myId = id; this->privData->myId = id;
this->privData->camera.SetPosition( this->privData->player.getPos() ); this->privData->camera.SetPosition( this->privData->player.getPos() );
Float3 offset = Float3( 0.0f ); 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.SetHeadOffset( offset );
this->privData->camera.UpdateOrientation(); this->privData->camera.UpdateOrientation();
} }
@ -500,6 +504,12 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
this->privData->camera.SetRotation( rotation ); this->privData->camera.SetRotation( rotation );
this->privData->player.setPos( position ); this->privData->player.setPos( position );
this->privData->player.setRot( rotation ); 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]; C_DynamicObj *object = (*this->privData->dynamicObjects)[decoded.object_ID];

View File

@ -157,6 +157,7 @@ void NetLoadState::LoadGame( const ::std::string &fileName )
RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2; RBData.scale = (Float3)oh->scale * (Float3)oh->boundingVolume.box.size * 2;
RBData.type = RB_Type_Cube; RBData.type = RB_Type_Cube;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
staticObject->updateRBWorld();
} }
if(oh->boundingVolume.geoType == CollisionGeometryType_Sphere) 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.scale = (Float3)oh->scale * oh->boundingVolume.sphere.radius * 2;
RBData.type = RB_Type_Sphere; RBData.type = RB_Type_Sphere;
staticObject->InitRB( RBData ); staticObject->InitRB( RBData );
staticObject->updateRBWorld();
} }
// !RB DEBUG // !RB DEBUG

View File

@ -5,7 +5,7 @@ using namespace GameLogic;
Game::PlayerData::PlayerData() 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 height = 2.0f;
Oyster::Math::Float radius = 0.5f; Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40; Oyster::Math::Float mass = 40;
@ -24,7 +24,7 @@ Game::PlayerData::PlayerData()
Game::PlayerData::PlayerData(int playerID,int teamID) 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 height = 2.0f;
Oyster::Math::Float radius = 0.5f; Oyster::Math::Float radius = 0.5f;
Oyster::Math::Float mass = 40; Oyster::Math::Float mass = 40;