restored lost edits

This commit is contained in:
Dander7BD 2014-02-27 15:13:08 +01:00
parent d145853d34
commit fed63e3593
2 changed files with 15 additions and 8 deletions

View File

@ -6,6 +6,8 @@
using namespace GameLogic; using namespace GameLogic;
using namespace Oyster::Physics; using namespace Oyster::Physics;
using namespace Oyster::Math;
const float MOVE_FORCE = 30; const float MOVE_FORCE = 30;
const float KEY_TIMER = 0.03f; const float KEY_TIMER = 0.03f;
const float AFFECTED_TIMER = 1.0f; const float AFFECTED_TIMER = 1.0f;
@ -63,16 +65,21 @@ void Player::initPlayerData()
this->deathTimer = 0; this->deathTimer = 0;
this->rotationUp = 0; this->rotationUp = 0;
ICustomBody::State state;
this->rigidBody->GetState( state );
state.staticFrictionCoeff = 0.0f;
state.dynamicFrictionCoeff = 0.0f;
this->rigidBody->SetState( state );
} }
void Player::BeginFrame() void Player::BeginFrame()
{ {
if( this->playerState != PLAYER_STATE_DEAD && this->playerState != PLAYER_STATE_DIED) if( !(this->playerState & (PLAYER_STATE_DEAD || PLAYER_STATE_DIED)) )
{ {
static const Float maxSpeed = 30;
weapon->Update(0.002f); weapon->Update(0.002f);
Oyster::Math::Float maxSpeed = 30;
// Rotate player accordingly // Rotate player accordingly
this->rigidBody->AddRotationAroundY(this->rotationUp); this->rigidBody->AddRotationAroundY(this->rotationUp);
this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized()); this->rigidBody->SetUp(this->rigidBody->GetState().centerPos.GetNormalized());
@ -81,9 +88,9 @@ void Player::BeginFrame()
Oyster::Math::Float4x4 xform; Oyster::Math::Float4x4 xform;
xform = this->rigidBody->GetState().GetOrientation(); xform = this->rigidBody->GetState().GetOrientation();
Oyster::Math::Float3 forwardDir = xform.v[2]; Oyster::Math::Float3 &forwardDir = xform.v[2].xyz;
Oyster::Math::Float3 upDir = xform.v[1]; Oyster::Math::Float3 &upDir = xform.v[1].xyz;
Oyster::Math::Float3 rightDir = xform.v[0]; Oyster::Math::Float3 &rightDir = xform.v[0].xyz;
forwardDir.Normalize(); forwardDir.Normalize();
upDir.Normalize(); upDir.Normalize();
rightDir.Normalize(); rightDir.Normalize();
@ -98,7 +105,7 @@ void Player::BeginFrame()
// Walking data // Walking data
Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0); Oyster::Math::Float3 walkDirection = Oyster::Math::Float3(0.0, 0.0, 0.0);
Oyster::Math::Float walkSpeed = this->playerStats.movementSpeed*0.2f; Oyster::Math::Float &walkSpeed = this->playerStats.movementSpeed;
// Check for input // Check for input
if(key_forward > 0.001) if(key_forward > 0.001)

View File

@ -10,7 +10,7 @@
#include "DynamicArray.h" #include "DynamicArray.h"
const float MAX_HP = 100.0f; const float MAX_HP = 100.0f;
const float BASIC_SPEED = 30.0f; const float BASIC_SPEED = 10.0f;
namespace GameLogic namespace GameLogic
{ {