GL - fixed respawning and also fixed weapon

This commit is contained in:
Erik Persson 2014-02-04 13:58:37 +01:00
parent 9efa4fcb23
commit bd9e4599cb
4 changed files with 19 additions and 16 deletions

View File

@ -132,7 +132,7 @@ bool GameState::LoadModels(std::wstring mapFile)
translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(50, 300, 0)); translate = Oyster::Math3D::TranslationMatrix(Oyster::Math::Float3(50, 300, 0));
//Oyster::Math3D::RotationMatrix_AxisZ() //Oyster::Math3D::RotationMatrix_AxisZ()
modelData.world = modelData.world * translate; modelData.world = modelData.world * translate;
modelData.visible = true; modelData.visible = false;
modelData.modelPath = L"building_corporation.dan"; modelData.modelPath = L"building_corporation.dan";
modelData.id = 4; modelData.id = 4;
// load models // load models

View File

@ -93,11 +93,14 @@ void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &usage, float
heldObject = NULL; heldObject = NULL;
return; return;
} }
Oyster::Math::Float3 up = owner->GetOrientation().v[1];
Oyster::Math::Float3 look = owner->GetLookDir();
Oyster::Math::Float3 pos = owner->GetPosition();
pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (500 * dt); pushForce = Oyster::Math::Float4(this->owner->GetLookDir()) * (50000 * dt);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition()); Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(look, up, pos);
Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/4,1,1,20); Oyster::Math::Float4x4 hitSpace = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/8,1,1,5);
Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace)); Oyster::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
forcePushData args; forcePushData args;
args.pushForce = pushForce; args.pushForce = pushForce;
@ -142,14 +145,14 @@ void AttatchmentMassDriver::ForcePull(const WEAPON_FIRE &usage, float dt)
void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt) void AttatchmentMassDriver::PickUpObject(const WEAPON_FIRE &usage, float dt)
{ {
//Oyster::Math::Float4 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized(); Oyster::Math::Float3 pos = owner->GetPosition() + owner->GetLookDir().GetNormalized()*5;
//Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,2000); Oyster::Collision3D::Sphere hitSphere = Oyster::Collision3D::Sphere(pos,20);
Oyster::Math::Float4x4 aim = Oyster::Math3D::ViewMatrix_LookAtDirection(owner->GetLookDir(), owner->GetRigidBody()->GetGravityNormal(), owner->GetPosition()); /*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::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::Collision3D::Frustrum hitFrustum = Oyster::Collision3D::Frustrum(Oyster::Math3D::ViewProjectionMatrix(aim,hitSpace));
*/
Oyster::Physics::API::Instance().ApplyEffect(hitSphere,this,AttemptPickUp);
Oyster::Physics::API::Instance().ApplyEffect(hitFrustum,this,AttemptPickUp);
} }

View File

@ -49,7 +49,7 @@ using namespace GameLogic;
//use kinetic energyloss of the collision in order too determin how much damage to take //use kinetic energyloss of the collision in order too determin how much damage to take
//use as part of the damage algorithm //use as part of the damage algorithm
int damageDone = 0; int damageDone = 0;
int forceThreashHold = 200; int forceThreashHold = 200000;
if(kineticEnergyLoss > forceThreashHold) //should only take damage if the force is high enough if(kineticEnergyLoss > forceThreashHold) //should only take damage if the force is high enough
{ {

View File

@ -15,37 +15,37 @@ namespace PrivateStatic
Float4x4 m = vp.GetTranspose(); Float4x4 m = vp.GetTranspose();
// left // left
lp.normal = m.v[3].xyz + m.v[0].xyz; lp.normal = Float4(m.v[3].xyz + m.v[0].xyz,0);
lp.phasing = lp.normal.GetMagnitude(); lp.phasing = lp.normal.GetMagnitude();
lp.normal /= lp.phasing; lp.normal /= lp.phasing;
lp.phasing = (m.v[3].w + m.v[0].w) / lp.phasing; lp.phasing = (m.v[3].w + m.v[0].w) / lp.phasing;
// right // right
rp.normal = m.v[3].xyz - m.v[0].xyz; rp.normal = Float4(m.v[3].xyz - m.v[0].xyz,0);
rp.phasing = rp.normal.GetMagnitude(); rp.phasing = rp.normal.GetMagnitude();
rp.normal /= rp.phasing; rp.normal /= rp.phasing;
rp.phasing = (m.v[3].w - m.v[0].w) / rp.phasing; rp.phasing = (m.v[3].w - m.v[0].w) / rp.phasing;
// bottom // bottom
bp.normal = m.v[3].xyz + m.v[1].xyz; bp.normal = Float4(m.v[3].xyz + m.v[1].xyz,0);
bp.phasing = bp.normal.GetMagnitude(); bp.phasing = bp.normal.GetMagnitude();
bp.normal /= bp.phasing; bp.normal /= bp.phasing;
bp.phasing = (m.v[3].w + m.v[1].w) / bp.phasing; bp.phasing = (m.v[3].w + m.v[1].w) / bp.phasing;
// top // top
tp.normal = m.v[3].xyz - m.v[1].xyz; tp.normal = Float4(m.v[3].xyz - m.v[1].xyz,0);
tp.phasing = tp.normal.GetMagnitude(); tp.phasing = tp.normal.GetMagnitude();
tp.normal /= tp.phasing; tp.normal /= tp.phasing;
tp.phasing = (m.v[3].w - m.v[1].w) / tp.phasing; tp.phasing = (m.v[3].w - m.v[1].w) / tp.phasing;
// near leftHanded DirectX // near leftHanded DirectX
np.normal = m.v[2].xyz; np.normal = Float4(m.v[2].xyz,0);
np.phasing = np.normal.GetMagnitude(); np.phasing = np.normal.GetMagnitude();
np.normal /= np.phasing; np.normal /= np.phasing;
np.phasing = m.v[2].w / np.phasing; np.phasing = m.v[2].w / np.phasing;
// far lefthanded // far lefthanded
fp.normal = m.v[3].xyz - m.v[2].xyz; fp.normal = Float4(m.v[3].xyz - m.v[2].xyz,0);
fp.phasing = fp.normal.GetMagnitude(); fp.phasing = fp.normal.GetMagnitude();
fp.normal /= fp.phasing; fp.normal /= fp.phasing;
fp.phasing = (m.v[3].w - m.v[2].w) / fp.phasing; fp.phasing = (m.v[3].w - m.v[2].w) / fp.phasing;