From 7f29b62c6fd4214ecfd07ebb5ef6e693cce22ca7 Mon Sep 17 00:00:00 2001 From: Erik Persson Date: Mon, 3 Feb 2014 16:19:24 +0100 Subject: [PATCH] GL - YOU CAN NOW SHOOT STUFF YAAAAY --- Code/Game/GameLogic/AttatchmentMassDriver.cpp | 27 ++++++++++++++----- .../Implementation/GameSession_Gameplay.cpp | 4 ++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index d5de9baa..babb4916 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -39,6 +39,12 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, ForcePush(usage,dt); break; case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS: + + if(hasObject) + { + ForcePush(usage,dt);//WARNING THIS IS A CRAP TEST TO MAKE SURE YOU CAN SHOOT BOXES + break; + } ForcePull(usage,dt); break; case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS: @@ -56,8 +62,9 @@ void AttatchmentMassDriver::Update(float dt) { Oyster::Physics::ICustomBody::State state; state = heldObject->GetState(); - - Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized(); + Oyster::Math::Float3 ownerPos = owner->GetPosition(); + ownerPos.y += 2; + Oyster::Math::Float3 pos = ownerPos + owner->GetLookDir().GetNormalized()*2; state.SetCenterPosition(pos); @@ -76,11 +83,12 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float if(hasObject) { - pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (800 * dt); + Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject); + pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (2000); Oyster::Physics::ICustomBody::State state = heldObject->GetState(); state.ApplyLinearImpulse((Oyster::Math::Float3)pushForce); heldObject->SetState(state); - Oyster::Physics::API::Instance().ReleaseFromLimbo(heldObject); + hasObject = false; heldObject = NULL; return; @@ -134,9 +142,14 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt) void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt) { - Oyster::Math::Float4 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized(); - Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,1); + //Oyster::Math::Float4 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized(); + //Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,2000); + Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition()); - Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp); + Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20); + Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); + + + Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,this,AttemptPickUp); } diff --git a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp index 8235c903..2b87e9cc 100644 --- a/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp +++ b/Code/Game/GameServer/Implementation/GameSession_Gameplay.cpp @@ -184,7 +184,9 @@ namespace DanBias } void GameSession::Gameplay_PlayerShot ( Protocol_PlayerShot& p, DanBias::GameClient* c ) { - c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); + //c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); + c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_SECONDARY_PRESS); + //c->GetPlayer()->UseWeapon(GameLogic::WEAPON_USE_PRIMARY_PRESS); } void GameSession::Gameplay_PlayerJump ( Protocol_PlayerJump& p, DanBias::GameClient* c ) {