Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameClient

This commit is contained in:
lindaandersson 2014-02-21 11:24:11 +01:00
commit 7de0a2ba1b
16 changed files with 84 additions and 36 deletions

View File

@ -697,7 +697,8 @@ Global
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|Win32.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.ActiveCfg = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x64.Build.0 = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.MinSizeRel|x86.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Any CPU.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.Release|Any CPU.ActiveCfg = Release|Win32
@ -714,7 +715,8 @@ Global
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|Win32.Build.0 = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x64.Build.0 = Release|x64
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32 {6391E709-D9FA-4FEF-A3B9-4343DB5A0C63}.RelWithDebInfo|x86.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Any CPU.ActiveCfg = Debug|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Debug|Any CPU.ActiveCfg = Debug|Win32
@ -731,7 +733,8 @@ Global
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Mixed Platforms.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|Win32.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.ActiveCfg = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x64.Build.0 = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.MinSizeRel|x86.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Any CPU.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.Release|Any CPU.ActiveCfg = Release|Win32
@ -748,7 +751,8 @@ Global
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Mixed Platforms.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|Win32.Build.0 = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x64.Build.0 = Release|x64
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.Build.0 = Release|Win32 {67D0FB00-FF1F-4DE4-84BD-664AE93D25EE}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
@ -764,7 +768,6 @@ Global
{C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} = {20720CA7-795C-45AD-A302-9383A6DD503A} {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A} {8690FDDF-C5B7-4C42-A337-BD5243F29B85} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{2A1BC987-AF42-4500-802D-89CD32FC1309} = {20720CA7-795C-45AD-A302-9383A6DD503A} {2A1BC987-AF42-4500-802D-89CD32FC1309} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{6391E709-D9FA-4FEF-A3B9-4343DB5A0C63} = {20720CA7-795C-45AD-A302-9383A6DD503A}
{C4C76A8D-44C5-4452-9F61-39C7E01CBDB4} = {F156EEBC-0195-4020-8700-4433208DE12B} {C4C76A8D-44C5-4452-9F61-39C7E01CBDB4} = {F156EEBC-0195-4020-8700-4433208DE12B}
{3EA5F14D-2A71-4588-A69D-87C4571C580F} = {F156EEBC-0195-4020-8700-4433208DE12B} {3EA5F14D-2A71-4588-A69D-87C4571C580F} = {F156EEBC-0195-4020-8700-4433208DE12B}
{7E3990D2-3D94-465C-B58D-64A74B3ECF9B} = {1322B12B-5E37-448A-AAAF-F637460DCB23} {7E3990D2-3D94-465C-B58D-64A74B3ECF9B} = {1322B12B-5E37-448A-AAAF-F637460DCB23}
@ -773,6 +776,5 @@ Global
{2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE} = {1322B12B-5E37-448A-AAAF-F637460DCB23} {2EC4DDED-8F75-4C86-A10B-E1E8EB29F3EE} = {1322B12B-5E37-448A-AAAF-F637460DCB23}
{604A12A7-07BF-4482-BDF3-7101C811F121} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {604A12A7-07BF-4482-BDF3-7101C811F121} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
{C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012} {C8CBA520-5D7D-4D61-A8DA-6E05FD132BCB} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
{67D0FB00-FF1F-4DE4-84BD-664AE93D25EE} = {C83A6FAD-E71F-4B1E-9D63-E93E61DDC012}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@ -105,7 +105,7 @@ void GamingUI::ReadKeyInput()
float yaw = this->input->GetYaw(); float yaw = this->input->GetYaw();
//if( yaw != 0.0f ) //This made the camera reset to a specific rotation. //if( yaw != 0.0f ) //This made the camera reset to a specific rotation.
{ {
this->netClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity) ); this->netClient->Send( Protocol_PlayerLeftTurn(yaw * mouseSensitivity,camera->GetLook()) );
} }
} }

View File

@ -66,6 +66,7 @@ void AttatchmentMassDriver::Update(float dt)
//state.centerPos = pos; //state.centerPos = pos;
heldObject->SetPosition(pos); heldObject->SetPosition(pos);
heldObject->SetLinearVelocity(Oyster::Math::Float3::null);
//heldObject->SetState(state); //heldObject->SetState(state);
} }
@ -82,8 +83,7 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
if(hasObject) if(hasObject)
{ {
Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject); pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (800);
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (400);
heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce); heldObject->ApplyImpulse((Oyster::Math::Float3)pushForce);
hasObject = false; hasObject = false;

View File

@ -20,37 +20,50 @@ using namespace GameLogic;
void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target); void Teleport(Oyster::Physics::ICustomBody &obj, Oyster::Math::Float3 target);
//Physics::ICustomBody::SubscriptMessage //Physics::ICustomBody::SubscriptMessage
void Player::PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss) void Player::PlayerCollision(Oyster::Physics::ICustomBody *objA, Oyster::Physics::ICustomBody *objB, Oyster::Math::Float kineticEnergyLoss)
{ {
Player *player = ((Player*)(rigidBodyPlayer->GetCustomTag())); Object *realObjA = ((Object*)(objA->GetCustomTag()));
Object *realObj = (Object*)obj->GetCustomTag(); //needs to be changed? Player *player;
Object *realObjB = (Object*)objB->GetCustomTag(); //needs to be changed?
if(!realObj) if(!realObjA)
return; return;
if(!player) if(!realObjB)
return; return;
switch (realObj->GetObjectType()) //check who is player and who is the object
if(realObjA->GetObjectType() == ObjectSpecialType::ObjectSpecialType_Player)
{
player = (Player*)realObjA;
}
else
{
player = (Player*)realObjB;
realObjB = realObjA;
}
switch (realObjB->GetObjectType())
{ {
case ObjectSpecialType::ObjectSpecialType_Generic: case ObjectSpecialType::ObjectSpecialType_Generic:
PlayerVObject(*player,*realObj, kineticEnergyLoss); PlayerVObject(*player,*realObjB, kineticEnergyLoss);
//return Physics::ICustomBody::SubscriptMessage_none; //return Physics::ICustomBody::SubscriptMessage_none;
break; break;
case ObjectSpecialType::ObjectSpecialType_StandardBox: case ObjectSpecialType::ObjectSpecialType_StandardBox:
PlayerVObject(*player,*realObj, kineticEnergyLoss); PlayerVObject(*player,*realObjB, kineticEnergyLoss);
//return Physics::ICustomBody::SubscriptMessage_none; //return Physics::ICustomBody::SubscriptMessage_none;
break; break;
case ObjectSpecialType::ObjectSpecialType_Player: case ObjectSpecialType::ObjectSpecialType_Player:
//return Physics::ICustomBody::SubscriptMessage_none; //return Physics::ICustomBody::SubscriptMessage_none;
break; break;
case ObjectSpecialType::ObjectSpecialType_World: case ObjectSpecialType::ObjectSpecialType_World:
PlayerVObject(*player,*realObj, kineticEnergyLoss); PlayerVObject(*player,*realObjB, kineticEnergyLoss);
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; //player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
break; break;
case ObjectSpecialType::ObjectSpecialType_CrystalFormation: case ObjectSpecialType::ObjectSpecialType_CrystalFormation:
PlayerVLethalObject(*player,*realObj, kineticEnergyLoss,realObj->GetExtraDamageOnCollision()); PlayerVLethalObject(*player,*realObjB, kineticEnergyLoss,realObjB->GetExtraDamageOnCollision());
//player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING; //player->playerState = PLAYER_STATE::PLAYER_STATE_WALKING;
break; break;
} }
@ -160,6 +173,9 @@ using namespace GameLogic;
//Collision between a player and a general static or dynamic object //Collision between a player and a general static or dynamic object
//use kinetic energyloss of the collision in order too determin how much damage to take //use kinetic energyloss of the collision in order too determin how much damage to take
//use as part of the damage algorithm //use as part of the damage algorithm
//Oyster::Math::Float3 prevVel = obj.GetRigidBody()->GetState().prev
int damageDone = 0; int damageDone = 0;
int forceThreashHold = 200000; int forceThreashHold = 200000;
@ -237,6 +253,7 @@ using namespace GameLogic;
weapon->heldObject = obj; //weapon now holds the object weapon->heldObject = obj; //weapon now holds the object
weapon->hasObject = true; weapon->hasObject = true;
break; break;
} }

View File

@ -40,7 +40,7 @@ namespace GameLogic
Oyster::Math::Float3 GetScale() override; Oyster::Math::Float3 GetScale() override;
Oyster::Math::Float4x4 GetOrientation() override; Oyster::Math::Float4x4 GetOrientation() override;
int GetID() const override; int GetID() const override;
void Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right) override; void SetLookDir(const Oyster::Math3D::Float3& lookDir) override;
void TurnLeft(Oyster::Math3D::Float deltaLeftRadians ) override; void TurnLeft(Oyster::Math3D::Float deltaLeftRadians ) override;
ObjectSpecialType GetObjectType() const override; ObjectSpecialType GetObjectType() const override;
void Inactivate() override; void Inactivate() override;

View File

@ -85,7 +85,7 @@ namespace GameLogic
* @param x: The relative x axis * @param x: The relative x axis
* @param y: The relative y axis * @param y: The relative y axis
**/ **/
virtual void Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right) = 0; virtual void SetLookDir(const Oyster::Math3D::Float3& lookDir) = 0;
/** Relative rotation around given axis /** Relative rotation around given axis
* @param leftRadians: The relative amount of radians to turn * @param leftRadians: The relative amount of radians to turn

View File

@ -86,9 +86,9 @@ ObjectSpecialType Game::PlayerData::GetObjectType() const
{ {
return this->player->GetObjectType(); return this->player->GetObjectType();
} }
void Game::PlayerData::Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right) void Game::PlayerData::SetLookDir(const Oyster::Math3D::Float3& lookDir)
{ {
this->player->Rotate(lookDir, right); this->player->SetLookDir(lookDir);
} }
void Game::PlayerData::TurnLeft(Oyster::Math3D::Float deltaLeftRadians ) void Game::PlayerData::TurnLeft(Oyster::Math3D::Float deltaLeftRadians )
{ {

View File

@ -74,7 +74,7 @@ Player::~Player(void)
void Player::BeginFrame() void Player::BeginFrame()
{ {
//weapon->Update(0.002f); weapon->Update(0.002f);
//Object::BeginFrame(); //Object::BeginFrame();
Oyster::Math::Float maxSpeed = 30; Oyster::Math::Float maxSpeed = 30;
@ -264,10 +264,10 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
this->rigidBody->SetPosition(spawnPoint); this->rigidBody->SetPosition(spawnPoint);
} }
void Player::Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right) void Player::SetLookDir(const Oyster::Math3D::Float3& lookDir)
{ {
// this is the camera right vector // this is the camera right vector
this->lookDir = lookDir; this->lookDir = -lookDir;
} }
void Player::TurnLeft(Oyster::Math3D::Float deltaRadians) void Player::TurnLeft(Oyster::Math3D::Float deltaRadians)

View File

@ -46,7 +46,7 @@ namespace GameLogic
void Respawn(Oyster::Math::Float3 spawnPoint); void Respawn(Oyster::Math::Float3 spawnPoint);
void Rotate(const Oyster::Math3D::Float3& lookDir, const Oyster::Math3D::Float3& right); void SetLookDir(const Oyster::Math3D::Float3& lookDir);
void TurnLeft(Oyster::Math3D::Float deltaRadians); void TurnLeft(Oyster::Math3D::Float deltaRadians);
@ -56,7 +56,7 @@ namespace GameLogic
* @param rigidBodyPlayer: physics object of the player * @param rigidBodyPlayer: physics object of the player
* @param obj: physics object for the object that collided with the player * @param obj: physics object for the object that collided with the player
********************************************************/ ********************************************************/
static void PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss); static void PlayerCollision(Oyster::Physics::ICustomBody *objA, Oyster::Physics::ICustomBody *objB, Oyster::Math::Float kineticEnergyLoss);
bool IsWalking(); bool IsWalking();

View File

@ -79,6 +79,7 @@ namespace GameLogic
{ {
public: public:
float deltaRadian; float deltaRadian;
float lookdir[3];
Protocol_PlayerLeftTurn() Protocol_PlayerLeftTurn()
{ {
@ -86,25 +87,40 @@ namespace GameLogic
this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short; this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short;
// deltaRadian // deltaRadian
this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float; this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float;
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
deltaRadian = 0.0f;
memset(&lookdir[0], 0, sizeof(float) * 3);
} }
Protocol_PlayerLeftTurn( const ::Oyster::Network::CustomNetProtocol &p ) Protocol_PlayerLeftTurn( const ::Oyster::Network::CustomNetProtocol &p )
{ {
this->deltaRadian = p[1].value.netFloat; this->deltaRadian = p[1].value.netFloat;
lookdir[0] = p[2].value.netFloat;
lookdir[1] = p[3].value.netFloat;
lookdir[2] = p[4].value.netFloat;
} }
Protocol_PlayerLeftTurn( float deltaRadian ) Protocol_PlayerLeftTurn( float deltaRadian,float v[3] )
{ {
this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn; this->protocol[0].value = protocol_Gameplay_PlayerLeftTurn;
this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short; this->protocol[0].type = ::Oyster::Network::NetAttributeType_Short;
// deltaRadian
this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float; this->protocol[1].type = ::Oyster::Network::NetAttributeType_Float;
this->protocol[2].type = Oyster::Network::NetAttributeType_Float;
this->protocol[3].type = Oyster::Network::NetAttributeType_Float;
this->protocol[4].type = Oyster::Network::NetAttributeType_Float;
this->deltaRadian = deltaRadian; this->deltaRadian = deltaRadian;
memcpy(&lookdir[0], &v[0], sizeof(float) * 3);
} }
::Oyster::Network::CustomNetProtocol GetProtocol() override ::Oyster::Network::CustomNetProtocol GetProtocol() override
{ {
this->protocol[1].value = this->deltaRadian; this->protocol[1].value = this->deltaRadian;
this->protocol[2].value = this->lookdir[0];
this->protocol[3].value = this->lookdir[1];
this->protocol[4].value = this->lookdir[2];
return protocol; return protocol;
} }

View File

@ -231,6 +231,7 @@ using namespace DanBias;
void GameSession::Gameplay_PlayerLeftTurn ( Protocol_PlayerLeftTurn& p, DanBias::GameClient* c ) void GameSession::Gameplay_PlayerLeftTurn ( Protocol_PlayerLeftTurn& p, DanBias::GameClient* c )
{ {
c->GetPlayer()->TurnLeft( p.deltaRadian ); c->GetPlayer()->TurnLeft( p.deltaRadian );
c->GetPlayer()->SetLookDir(p.lookdir);
} }
void GameSession::Gameplay_PlayerChangeWeapon ( Protocol_PlayerChangeWeapon& p, DanBias::GameClient* c ) void GameSession::Gameplay_PlayerChangeWeapon ( Protocol_PlayerChangeWeapon& p, DanBias::GameClient* c )
{ {

View File

@ -288,6 +288,7 @@ void API_Impl::UpdateWorld()
{ {
this->customBodies[i]->CallSubscription_Move(); this->customBodies[i]->CallSubscription_Move();
} }
simpleBody->SetPreviousVelocity(simpleBody->GetState().previousVelocity);
} }
this->dynamicsWorld->stepSimulation(this->timeStep, 1, this->timeStep); this->dynamicsWorld->stepSimulation(this->timeStep, 1, this->timeStep);

View File

@ -423,3 +423,8 @@ void SimpleRigidBody::ReleaseFromLimbo()
{ {
this->rigidBody->setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT); this->rigidBody->setCollisionFlags(btCollisionObject::CF_KINEMATIC_OBJECT);
} }
void SimpleRigidBody::SetPreviousVelocity(::Oyster::Math::Float3 velocity)
{
this->state.previousVelocity = velocity;
}

View File

@ -64,6 +64,7 @@ namespace Oyster
void SetCollisionShape(btCollisionShape* shape); void SetCollisionShape(btCollisionShape* shape);
void SetMotionState(btDefaultMotionState* motionState); void SetMotionState(btDefaultMotionState* motionState);
void SetRigidBody(btRigidBody* rigidBody); void SetRigidBody(btRigidBody* rigidBody);
void SetPreviousVelocity(Math::Float3 velocity);
void PreStep(const btCollisionWorld* collisionWorld); void PreStep(const btCollisionWorld* collisionWorld);
@ -72,6 +73,8 @@ namespace Oyster
void MoveToLimbo(); void MoveToLimbo();
void ReleaseFromLimbo(); void ReleaseFromLimbo();
private: private:
btCollisionShape* collisionShape; btCollisionShape* collisionShape;

View File

@ -10,7 +10,7 @@ namespace Oyster
{ {
namespace Struct namespace Struct
{ {
inline CustomBodyState::CustomBodyState( ::Oyster::Math::Float mass, ::Oyster::Math::Float3 reach, ::Oyster::Math::Float restitutionCoeff, ::Oyster::Math::Float staticFrictionCoeff, ::Oyster::Math::Float dynamicFrictionCoeff, const ::Oyster::Math::Float3 &centerPos, const ::Oyster::Math::Quaternion& quaternion) inline CustomBodyState::CustomBodyState( ::Oyster::Math::Float mass, ::Oyster::Math::Float3 reach, ::Oyster::Math::Float restitutionCoeff, ::Oyster::Math::Float staticFrictionCoeff, ::Oyster::Math::Float dynamicFrictionCoeff, const ::Oyster::Math::Float3 &centerPos, const ::Oyster::Math::Quaternion& quaternion, ::Oyster::Math::Float3 previousVelocity)
{ {
this->mass = mass; this->mass = mass;
this->reach = reach; this->reach = reach;
@ -19,6 +19,7 @@ namespace Oyster
this->dynamicFrictionCoeff = dynamicFrictionCoeff; this->dynamicFrictionCoeff = dynamicFrictionCoeff;
this->centerPos = centerPos; this->centerPos = centerPos;
this->quaternion = quaternion; this->quaternion = quaternion;
this->previousVelocity = ::Oyster::Math::Float3::null;
} }
inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state ) inline CustomBodyState & CustomBodyState::operator = ( const CustomBodyState &state )
@ -30,6 +31,7 @@ namespace Oyster
this->dynamicFrictionCoeff = state.dynamicFrictionCoeff; this->dynamicFrictionCoeff = state.dynamicFrictionCoeff;
this->centerPos = state.centerPos; this->centerPos = state.centerPos;
this->quaternion = state.quaternion; this->quaternion = state.quaternion;
this->previousVelocity = state.previousVelocity;
return *this; return *this;
} }

View File

@ -16,12 +16,13 @@ namespace Oyster
public: public:
// Default constructor // Default constructor
CustomBodyState( ::Oyster::Math::Float mass = 1.0f, CustomBodyState( ::Oyster::Math::Float mass = 1.0f,
::Oyster::Math::Float3 reach = ::Oyster::Math::Float3(0,0,0), ::Oyster::Math::Float3 reach = ::Oyster::Math::Float3::null,
::Oyster::Math::Float restitutionCoeff = 0.5f, ::Oyster::Math::Float restitutionCoeff = 0.5f,
::Oyster::Math::Float staticFrictionCoeff = 1.0f, ::Oyster::Math::Float staticFrictionCoeff = 1.0f,
::Oyster::Math::Float dynamicFrictionCoeff = 1.0f, ::Oyster::Math::Float dynamicFrictionCoeff = 1.0f,
const ::Oyster::Math::Float3 &centerPos = ::Oyster::Math::Float3::null, const ::Oyster::Math::Float3 &centerPos = ::Oyster::Math::Float3::null,
const ::Oyster::Math::Quaternion &quaternion = ::Oyster::Math::Quaternion(::Oyster::Math::Float3(0, 0, 0), 1)); const ::Oyster::Math::Quaternion &quaternion = ::Oyster::Math::Quaternion(::Oyster::Math::Float3(0, 0, 0), 1),
::Oyster::Math::Float3 previousVelocity = ::Oyster::Math::Float3::null);
// Assignment operator // Assignment operator
CustomBodyState & operator = ( const CustomBodyState &state ); CustomBodyState & operator = ( const CustomBodyState &state );
@ -34,7 +35,7 @@ namespace Oyster
// Variables for state // Variables for state
::Oyster::Math::Float mass, restitutionCoeff, staticFrictionCoeff, dynamicFrictionCoeff; ::Oyster::Math::Float mass, restitutionCoeff, staticFrictionCoeff, dynamicFrictionCoeff;
::Oyster::Math::Float3 reach, centerPos; ::Oyster::Math::Float3 reach, centerPos, previousVelocity;
::Oyster::Math::Quaternion quaternion; ::Oyster::Math::Quaternion quaternion;
}; };
} }