moved ForcePushAction for massdriver to collisionManager

This commit is contained in:
Erik Persson 2014-01-22 14:26:45 +01:00
parent 80204ecbe3
commit 43eac4cbe3
4 changed files with 14 additions and 11 deletions

View File

@ -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);
}
/********************************************************

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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();