GL - fixed movement(pretty unstable but its working)
This commit is contained in:
parent
3c928f497f
commit
9fc8a8840f
|
@ -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)
|
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)
|
: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);
|
weapon = new Weapon(2,this);
|
||||||
|
|
||||||
this->life = 100;
|
this->life = 100;
|
||||||
this->teamID = -1;
|
this->teamID = teamID;
|
||||||
this->playerState = PLAYER_STATE_IDLE;
|
this->playerState = PLAYER_STATE_IDLE;
|
||||||
this->lookDir = Oyster::Math::Float3(0,0,-1);
|
this->lookDir = Oyster::Math::Float3(0,0,-1);
|
||||||
this->moveDir = Oyster::Math::Float3(0,0,0);
|
|
||||||
key_forward = 0;
|
key_forward = 0;
|
||||||
key_backward = 0;
|
key_backward = 0;
|
||||||
key_strafeRight = 0;
|
key_strafeRight = 0;
|
||||||
key_strafeLeft = 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)
|
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)
|
||||||
|
|
|
@ -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)
|
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)
|
: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)
|
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)
|
: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)
|
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;
|
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)
|
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;
|
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)
|
StaticObject::~StaticObject(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue