diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp index 0fb93995..54841b39 100644 --- a/Code/Game/GameLogic/Player.cpp +++ b/Code/Game/GameLogic/Player.cpp @@ -17,17 +17,34 @@ Player::Player() Player::Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID) :DynamicObject(rigidBody, EventOnCollision, type, objectID) { + this->rigidBody = rigidBody; + + Oyster::Math::Float3 centerPosition = Oyster::Math::Float3(0,400,0); + + Oyster::Math::Float3 size = Oyster::Math::Float3(0.25f,1.0f,0.5f); + Oyster::Math::Float mass = 60; + Oyster::Math::Float restitutionCoeff = 0.5; + Oyster::Math::Float frictionCoeff_Static = 0.4; + Oyster::Math::Float frictionCoeff_Dynamic = 0.3; + + + this->rigidBody = Oyster::Physics::API::Instance().AddCollisionBox(size, Oyster::Math::Float4(0, 0, 0, 1), centerPosition, mass, 0.5f, 0.8f, 0.6f ); + this->rigidBody->SetAngularFactor(0.0f); + weapon = new Weapon(2,this); this->life = 100; - this->teamID = -1; + this->teamID = teamID; this->playerState = PLAYER_STATE_IDLE; this->lookDir = Oyster::Math::Float3(0,0,-1); - this->moveDir = Oyster::Math::Float3(0,0,0); key_forward = 0; key_backward = 0; key_strafeRight = 0; key_strafeLeft = 0; + + this->moveDir = Oyster::Math::Float3(0,0,0); + this->moveSpeed = 100; + this->previousMoveSpeed = Oyster::Math::Float3(0,0,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) diff --git a/Code/Game/GameLogic/StaticObject.cpp b/Code/Game/GameLogic/StaticObject.cpp index 158ee87e..7124b14a 100644 --- a/Code/Game/GameLogic/StaticObject.cpp +++ b/Code/Game/GameLogic/StaticObject.cpp @@ -14,25 +14,25 @@ StaticObject::StaticObject() StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID) :Object(rigidBody, EventOnCollision, type, objectID) { - //use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static + rigidBody->SetMass(0); } StaticObject::StaticObject(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) :Object(rigidBody, EventOnCollision, type, objectID) { - //use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static + rigidBody->SetMass(0); } StaticObject::StaticObject(Oyster::Physics::ICustomBody *rigidBody , void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, Oyster::Math::Float extraDamageOnCollision) { this->extraDamageOnCollision = extraDamageOnCollision; - //use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static + rigidBody->SetMass(0); } StaticObject::StaticObject(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, Oyster::Math::Float extraDamageOnCollision) { this->extraDamageOnCollision = extraDamageOnCollision; - //use setMass(when it is made) and set the mass to 0 in order to ensure that the object is static + rigidBody->SetMass(0); } StaticObject::~StaticObject(void) {