From 6818dda2b95ae64c10441b975e53f4dab8787350 Mon Sep 17 00:00:00 2001 From: lindaandersson Date: Wed, 5 Feb 2014 09:06:33 +0100 Subject: [PATCH] GL - testing --- Code/Game/GameLogic/CollisionManager.cpp | 2 +- Code/Game/GameLogic/Game_PlayerData.cpp | 2 ++ Code/Game/GameLogic/Object.cpp | 14 ++++++++++++++ Code/Game/GameLogic/Player.cpp | 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 24bb6bba..cb6862bb 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -84,7 +84,7 @@ using namespace GameLogic; if(kineticEnergyLoss > forceThreashHold) //should only take damage if the force is high enough { damageDone = kineticEnergyLoss * 0.10f; - player.DamageLife(damageDone); + //player.DamageLife(damageDone); } } diff --git a/Code/Game/GameLogic/Game_PlayerData.cpp b/Code/Game/GameLogic/Game_PlayerData.cpp index bf2cbcbe..e73b8255 100644 --- a/Code/Game/GameLogic/Game_PlayerData.cpp +++ b/Code/Game/GameLogic/Game_PlayerData.cpp @@ -11,6 +11,8 @@ Game::PlayerData::PlayerData() sbDesc.size = Oyster::Math::Float3(4,7,4); sbDesc.mass = 70; sbDesc.restitutionCoeff = 0.5; + sbDesc.frictionCoeff_Static = 0.4; + sbDesc.frictionCoeff_Dynamic = 0.3; sbDesc.rotation = Oyster::Math::Float3(0, Oyster::Math::pi, 0); //create rigid body diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 8cb57aae..6f3ef28b 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -156,6 +156,8 @@ void Object::EndFrame() //error int i =0 ; } + + if(currPhysicsState.GetGravityNormal()!= Float3::null) { Oyster::Math::Float4 axis; @@ -170,6 +172,18 @@ void Object::EndFrame() Oyster::Math::Float3 debug = ::LinearAlgebra3D::WorldAxisOf(::LinearAlgebra3D::Rotation(axis.xyz), Oyster::Math::Float3::standard_unit_y); debug += currPhysicsState.GetGravityNormal(); } + Oyster::Math::Float3 pos = currPhysicsState.GetCenterPosition(); + Oyster::Math::Float3 up = -currPhysicsState.GetGravityNormal(); + //300, 0,0, + //1,0,0 + + if( pos.GetLength() < 303.5f) + { + Oyster::Math::Float moveUp = 303.5 - pos.GetLength(); + up *= moveUp; + + //currPhysicsState.SetCenterPosition(pos + up); + } if(currPhysicsState.GetLinearMomentum() !=currPhysicsState.GetLinearMomentum()) diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 54e246a7..6b7129d2 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -6,7 +6,7 @@ using namespace GameLogic; using namespace Oyster::Physics; -const int MOVE_FORCE = 5000; +const int MOVE_FORCE = 500; Player::Player() :DynamicObject() { @@ -73,7 +73,7 @@ void Player::EndFrame() Oyster::Math::Float3 up = currPhysicsState.GetOrientation().v[1]; Oyster::Math::Float3 deltaAxis = up * (-dx * 0.02) ; - currPhysicsState.AddRotation(deltaAxis); + //currPhysicsState.AddRotation(deltaAxis); dx = 0; this->newPhysicsState = this->currPhysicsState; }