diff --git a/Code/Game/DanBiasGame/GameClientState/GameState.cpp b/Code/Game/DanBiasGame/GameClientState/GameState.cpp index 5214875a..f3ce7b46 100644 --- a/Code/Game/DanBiasGame/GameClientState/GameState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/GameState.cpp @@ -453,14 +453,14 @@ void GameState::readKeyInput(InputClass* KeyInput) } //send delta mouse movement - //if (KeyInput->IsMousePressed()) + if (KeyInput->IsMousePressed()) { camera->Yaw(-KeyInput->GetYaw()); camera->Pitch(KeyInput->GetPitch()); pitch = KeyInput->GetPitch(); camera->UpdateViewMatrix(); GameLogic::Protocol_PlayerLook playerLookDir; - Oyster::Math::Float4 look = camera->GetLook(); + Oyster::Math::Float4 look = camera->GetRight(); playerLookDir.lookDirX = look.x; playerLookDir.lookDirY = look.y; playerLookDir.lookDirZ = look.z; diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index 15de4399..c8cbc997 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -16,7 +16,7 @@ Game::PlayerData::PlayerData() //create rigid body Oyster::Physics::ICustomBody* rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f ); - + //rigidBody->SetAngularFactor(0.0f); //create player with this rigid body this->player = new Player(rigidBody,Level::LevelCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER); this->player->GetRigidBody()->SetCustomTag(this); diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index b2b74838..535268b7 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -107,13 +107,9 @@ void Object::setAfterCollisonFunc(Oyster::Physics::ICustomBody::SubscriptMessage Oyster::Math::Float3 Object::GetPosition() { - Oyster::Physics::ICustomBody::State state; - state = this->rigidBody->GetState(); - return state.centerPos; + return (Oyster::Math::Float3) this->rigidBody->GetState().centerPos; } Oyster::Math::Float4x4 Object::GetOrientation() { - Oyster::Physics::ICustomBody::State state; - state = this->rigidBody->GetState(); - return state.GetOrientation(); + return this->rigidBody->GetState().GetOrientation(); } \ No newline at end of file diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index acbb33a9..9e826ef5 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -22,7 +22,6 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, OBJECT_TYPE type) { InitPlayer(); } - Player::Player(void* collisionFuncBefore, void* collisionFuncAfter, OBJECT_TYPE type) :DynamicObject(collisionFuncBefore,collisionFuncAfter,type) { @@ -60,21 +59,14 @@ Player::~Player(void) void Player::BeginFrame() { - weapon->Update(0.002f); + //weapon->Update(0.002f); Object::BeginFrame(); } void Player::EndFrame() { // snap to axis - Object::EndFrame(); - // rotate - - //Oyster::Math::Float3 up = currPhysicsState.GetOrientation().v[1]; - //Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ; - - //currPhysicsState.AddRotation(deltaAxis); - + Object::EndFrame(); } void Player::Move(const PLAYER_MOVEMENT &movement) @@ -143,11 +135,12 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint) this->life = 100; this->playerState = PLAYER_STATE::PLAYER_STATE_IDLE; this->lookDir = Oyster::Math::Float4(1,0,0); - //this->newPhysicsState.centerPos = spawnPoint; + this->rigidBody->SetPosition(spawnPoint); } void Player::Rotate(const Oyster::Math3D::Float4 lookDir) { + // right Oyster::Math::Float dx = lookDir.w; if(dx > 0.0f) { @@ -156,12 +149,16 @@ void Player::Rotate(const Oyster::Math3D::Float4 lookDir) this->lookDir = lookDir.xyz; this->dx = lookDir.w; + + + Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1]; + this->rigidBody->SetUpAndRight(up, lookDir.xyz); } void Player::Jump() { Oyster::Math::Float3 up = this->rigidBody->GetState().GetOrientation().v[1]; - //newPhysicsState.ApplyLinearImpulse(up * MOVE_FORCE * this->gameInstance->GetFrameTime()); + //this->rigidBody->GetState().SetLinearVelocity(up *10); } bool Player::IsWalking()