From ab962eea99671e0ca079ea286e3e6e9b94af99f1 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Mon, 3 Feb 2014 16:20:05 +0100 Subject: [PATCH] GL - added error check --- Code/Game/GameLogic/Game_PlayerData.cpp | 6 +++--- Code/Game/GameLogic/Object.cpp | 7 ++++++- Code/Game/GameLogic/Player.cpp | 18 ------------------ 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index 18d058d0..bfd352ae 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -11,18 +11,18 @@ Game::PlayerData::PlayerData() sbDesc.size = Oyster::Math::Float3(4,7,4); sbDesc.mass = 70; sbDesc.restitutionCoeff = 0.5; - sbDesc.rotation = Oyster::Math3D::RotationMatrix_AxisY(Utility::Value::Radian(180)); + sbDesc.rotation = Oyster::Math::Float3(0, Oyster::Math::pi, 0); //create rigid body Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release(); //create player with this rigid body this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER); this->player->GetRigidBody()->SetCustomTag(this); - Oyster::Physics::ICustomBody::State state; + /*Oyster::Physics::ICustomBody::State state; this->player->GetRigidBody()->GetState(state); state.SetRotation(Oyster::Math::Float3(0, Oyster::Math::pi, 0)); this->player->GetRigidBody()->SetState(state); - player->EndFrame(); + player->EndFrame();*/ } Game::PlayerData::PlayerData(int playerID,int teamID) { diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 8692aa72..e04e1b8f 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -126,13 +126,18 @@ void Object::BeginFrame() if(newPhysicsState.GetGravityNormal()!= Float3::null) { Oyster::Math3D::SnapAngularAxis(Oyster::Math::Float4(newPhysicsState.GetAngularAxis(), 0), Oyster::Math::Float4::standard_unit_y, -Oyster::Math::Float4(newPhysicsState.GetGravityNormal()), axis); + if(axis !=axis) + { + //error + int i =0 ; + } newPhysicsState.SetRotation(axis.xyz); newPhysicsState.SetAngularMomentum(Float3::null); Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y); debug += newPhysicsState.GetGravityNormal(); } - + this->rigidBody->SetState(this->newPhysicsState); } // update physic diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 1ab58d11..b891ac25 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -117,7 +117,6 @@ void Player::UseWeapon(const WEAPON_FIRE &usage) 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); @@ -126,26 +125,9 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint) void Player::Rotate(const Oyster::Math3D::Float4 lookDir) { Oyster::Math::Float dx = lookDir.w; - //deltaLook = this->lookDir - lookDir; - - //Oyster::Math::Float4 up = -setState.GetGravityNormal(); - //Oyster::Math::Float4 pos = setState.GetCenterPosition(); - //Oyster::Math::Float4x4 world = Oyster::Math3D::OrientationMatrix_LookAtDirection(lookDir, up.xyz, pos.xyz); - - // cant set rotation - //setState.AddRotation(); - Oyster::Math::Float3 up = currPhysicsState.GetOrientation().v[1]; Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ; - - //setState.SetOrientation(world); newPhysicsState.AddRotation(deltaAxis); - //setState.SetOrientation() - //this->lookDir = lookDir - up.xyz; - //this->lookDir = lookDir; - - //this->setState.AddRotation(Oyster::Math::Float4(x, y)); - //this->setState.SetRotation(); this->lookDir = lookDir.xyz; }