Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
b810fa1586
|
@ -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
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ Player::~Player(void)
|
||||||
void Player::BeginFrame()
|
void Player::BeginFrame()
|
||||||
{
|
{
|
||||||
weapon->Update(0.002f);
|
weapon->Update(0.002f);
|
||||||
if(playerState == PLAYER_STATE_DEAD) Respawn(Oyster::Math::Float3(0,308,0));
|
//if(playerState == PLAYER_STATE_DEAD) Respawn(Oyster::Math::Float3(0,308,0));
|
||||||
Object::BeginFrame();
|
Object::BeginFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -1064,38 +1064,42 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
||||||
|
|
||||||
Float TimeOfContact( const Sphere &protoStart, const Sphere &protoEnd, const Point &deuter )
|
Float TimeOfContact( const Sphere &protoStart, const Sphere &protoEnd, const Point &deuter )
|
||||||
{ // Bisection with 5 levels of detail
|
{ // Bisection with 5 levels of detail
|
||||||
Float t = 0.5f;
|
Float t = 0.5f,
|
||||||
|
d = 0.25f;
|
||||||
Sphere s;
|
Sphere s;
|
||||||
for( int i = 0; i < 5; ++i )
|
for( int i = 0; i < 5; ++i )
|
||||||
{
|
{
|
||||||
Nlerp( protoStart, protoEnd, t, s );
|
Nlerp( protoStart, protoEnd, t, s );
|
||||||
if( Intersect(s, deuter) )
|
if( Intersect(s, deuter) )
|
||||||
{
|
{
|
||||||
t *= 0.5f;
|
t -= d;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t *= 1.5f;
|
t += d;
|
||||||
}
|
}
|
||||||
|
d *= 0.5f;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Float TimeOfContact( const Box &protoStart, const Box &protoEnd, const Point &deuter )
|
Float TimeOfContact( const Box &protoStart, const Box &protoEnd, const Point &deuter )
|
||||||
{ // Bisection with 5 levels of detail
|
{ // Bisection with 5 levels of detail
|
||||||
Float t = 0.5f;
|
Float t = 0.5f,
|
||||||
|
d = 0.25f;
|
||||||
Box b;
|
Box b;
|
||||||
for( int i = 0; i < 5; ++i )
|
for( int i = 0; i < 5; ++i )
|
||||||
{
|
{
|
||||||
Nlerp( protoStart, protoEnd, t, b );
|
Nlerp( protoStart, protoEnd, t, b );
|
||||||
if( Intersect(b, deuter) )
|
if( Intersect(b, deuter) )
|
||||||
{
|
{
|
||||||
t *= 0.5f;
|
t -= d;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t *= 1.5f;
|
t += d;
|
||||||
}
|
}
|
||||||
|
d *= 0.5f;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue