From 3520062577bd0a2b476bd729cfffaf523c9ffb4c Mon Sep 17 00:00:00 2001 From: Robin Engman Date: Wed, 19 Feb 2014 13:59:59 +0100 Subject: [PATCH] Implemented TurnLeft function --- Code/Game/GameLogic/Player.cpp | 8 ++++++-- Code/Game/GameLogic/Player.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 00d098fa..b067d036 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -33,6 +33,8 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision) this->moveDir = Oyster::Math::Float3(0,0,0); this->moveSpeed = 100; this->previousMoveSpeed = Oyster::Math::Float3(0,0,0); + + this->rotationUp = 0; } Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID) @@ -53,6 +55,8 @@ Player::Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustom this->moveDir = Oyster::Math::Float3(0,0,0); this->moveSpeed = 20; this->previousMoveSpeed = Oyster::Math::Float3(0,0,0); + + this->rotationUp = 0; } Player::~Player(void) @@ -229,8 +233,8 @@ void Player::Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D: } void Player::TurnLeft(Oyster::Math3D::Float deltaRadians) { - //TODO: Conver delta radians to something that phyhsics use... - //this->rigidBody->; + this->rotationUp += deltaRadians; + this->rigidBody->SetRotationAsAngularAxis(Oyster::Math3D::Float4(this->rigidBody->GetState().centerPos.GetNormalized(), this->rotationUp)); } void Player::Jump() diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h index 73737d60..13c6e300 100644 --- a/Code/Game/GameLogic/Player.h +++ b/Code/Game/GameLogic/Player.h @@ -96,6 +96,8 @@ namespace GameLogic Oyster::Math::Float moveSpeed; Oyster::Math::Float3 previousMoveSpeed; + Oyster::Math::Float rotationUp; + bool hasTakenDamage; float invincibleCooldown;