GL - Massdriver updates

This commit is contained in:
Erik Persson 2014-02-12 13:12:51 +01:00
parent 26a6bde42a
commit b34df93e49
3 changed files with 20 additions and 15 deletions

View File

@ -66,7 +66,7 @@ void AttatchmentMassDriver::Update(float dt)
Oyster::Physics::ICustomBody::State ownerState = owner->GetRigidBody()->GetState();
Oyster::Math::Float3 up = -ownerState.GetOrientation().v[2];
up *= -0.3;
Oyster::Math::Float3 pos = ownerPos + up + (owner->GetLookDir().GetNormalized()*5);
Oyster::Math::Float3 pos = ownerPos + up + (owner->GetLookDir().GetNormalized()*10);
state.centerPos = pos;
@ -96,14 +96,14 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
return;
}
Oyster::Math::Float radius = 2;
Oyster::Math::Float radius = 4;
Oyster::Math::Float3 look = owner->GetLookDir().GetNormalized();
Oyster::Math::Float lenght = 5;
Oyster::Math::Float lenght = 10;
Oyster::Math::Float3 pos = owner->GetRigidBody()->GetState().centerPos;
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (200 * dt);
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (100);
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(look*5,pos,radius);
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius);
@ -129,7 +129,7 @@ void AttatchmentMassDriver::ForceZip(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
@ -137,21 +137,24 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
//if no object has been picked up then suck objects towards you
Oyster::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (100 * dt);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetState().GetOrientation().v[2].xyz, owner->GetPosition());
Oyster::Math::Float radius = 4;
Oyster::Math::Float3 look = owner->GetLookDir().GetNormalized();
Oyster::Math::Float lenght = 10;
Oyster::Math::Float3 pos = owner->GetRigidBody()->GetState().centerPos;
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::Math::Float4 pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (100);
Oyster::Collision3D::Cone *hitCone = new Oyster::Collision3D::Cone(lenght,pos,(Oyster::Math::Float4)owner->GetRigidBody()->GetState().quaternion,radius);
forcePushData args;
args.pushForce = -pushForce;
//Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,&args,ForcePushAction);
Oyster::Physics::API::Instance().ApplyEffect(hitCone,&args,ForcePushAction);
}
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
{
Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*5;
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,20);
Oyster::Collision3D::Sphere *hitSphere = new Oyster::Collision3D::Sphere(pos,10);
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);

View File

@ -14,10 +14,10 @@ AttatchmentSocket::AttatchmentSocket(void)
AttatchmentSocket::~AttatchmentSocket(void)
{
if(this->attatchment)
delete this->attatchment;
//if(this->attatchment)
//delete this->attatchment;
this->attatchment = 0;
//this->attatchment = 0;
}
IAttatchment* AttatchmentSocket::GetAttatchment()

View File

@ -102,6 +102,8 @@ void Player::BeginFrame()
moveDirection = forward + back + left + right;
//moveDirection.Normalize();
rigidBody->SetLinearVelocity( MOVE_FORCE * moveDirection );
weapon->Update(0.01f);
}
void Player::EndFrame()