diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp index b3fdc844..11ec5ea8 100644 --- a/Code/Game/GameLogic/AttatchmentMassDriver.cpp +++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp @@ -37,7 +37,7 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, ForcePull(usage,dt); break; } - + } /******************************************************** @@ -51,17 +51,7 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); //Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,ForcePushAction); - //create frustum that will then collide with object and push them in the aimed direction - //sample with frustum using visitor pattern(needs a function ptr sent with it that idicates what happens when a collision has been made) -} - -void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj) -{ - Oyster::Physics::ICustomBody::State state = obj->GetState(); - Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500); - state.ApplyLinearImpulse(pushForce); - obj->SetState(state); } /******************************************************** diff --git a/Code/Game/GameLogic/CollisionManager.cpp b/Code/Game/GameLogic/CollisionManager.cpp index 4dfebedf..73c7b7ed 100644 --- a/Code/Game/GameLogic/CollisionManager.cpp +++ b/Code/Game/GameLogic/CollisionManager.cpp @@ -3,6 +3,7 @@ #include "DynamicObject.h" #include "Player.h" #include "Level.h" +#include "AttatchmentMassDriver.h" using namespace Oyster; @@ -57,3 +58,9 @@ using namespace GameLogic; { return Physics::ICustomBody::SubscriptMessage_ignore_collision_response; } + + void AttatchmentMassDriver::ForcePushAction(Oyster::Physics::ICustomBody *obj) +{ + Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500); + ((Object*)obj->GetCustomTag())->ApplyLinearImpulse(pushForce); +} diff --git a/Code/Game/GameLogic/Object.cpp b/Code/Game/GameLogic/Object.cpp index 2937c605..034ded3d 100644 --- a/Code/Game/GameLogic/Object.cpp +++ b/Code/Game/GameLogic/Object.cpp @@ -49,6 +49,11 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type) this->type = type; } +void Object::ApplyLinearImpulse(Oyster::Math::Float4 force) +{ + setState.ApplyLinearImpulse(force); +} + Object::~Object(void) { diff --git a/Code/Game/GameLogic/Object.h b/Code/Game/GameLogic/Object.h index 1316b287..26bf17db 100644 --- a/Code/Game/GameLogic/Object.h +++ b/Code/Game/GameLogic/Object.h @@ -23,6 +23,7 @@ namespace GameLogic OBJECT_TYPE GetType() const; int GetID() const; Oyster::Physics::ICustomBody* GetRigidBody(); + void ApplyLinearImpulse(Oyster::Math::Float4 force); void BeginFrame(); void EndFrame();