GL - Massdriver usage of applyeffect

This commit is contained in:
Erik Persson 2014-01-22 13:02:13 +01:00
parent 0443e753e8
commit 80204ecbe3
2 changed files with 14 additions and 1 deletions

View File

@ -46,13 +46,24 @@ void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &usage,
void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float dt)
{
Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition());
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,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);
}
/********************************************************
* Pulls the player in the direction he is looking, used for fast movement(kinda like a jetpack)
********************************************************/

View File

@ -36,6 +36,8 @@ namespace GameLogic
********************************************************/
void ForceSuck(const WEAPON_FIRE &usage, float dt);
void ForcePushAction(Oyster::Physics::ICustomBody *obj);
private:
};