GL - massdriver

This commit is contained in:
Erik Persson 2014-02-12 10:43:41 +01:00
parent 2a214f5305
commit 0d643a890d
1 changed files with 9 additions and 10 deletions

View File

@ -104,10 +104,13 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,50); Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,50);
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
Oyster::Collision3D::Cone *hitCone;
forcePushData args; forcePushData args;
args.pushForce = pushForce; args.pushForce = pushForce;
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction); //Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
} }
/******************************************************** /********************************************************
@ -126,7 +129,7 @@ void AttatchmentMassDriver::ForceZip(const WEAPON_FIRE &usage, float dt)
void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt) void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
{ {
if(hasObject) return; //this test checks if the weapon already has something picked up, if so then it cant use this function //if(hasObject) return; //this test checks if the weapon already has something picked up, if so then it cant use this function
PickUpObject(usage,dt); //first test if there is a nearby object to pickup PickUpObject(usage,dt); //first test if there is a nearby object to pickup
@ -142,19 +145,15 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
forcePushData args; forcePushData args;
args.pushForce = -pushForce; args.pushForce = -pushForce;
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction); //Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
} }
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt) void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
{ {
Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*5; Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*5;
Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,20); Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,20);
/*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(hitSphere,this,AttemptPickUp); Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);
delete hitSphere;
} }