Merge branch 'Physics' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
6e9423670f
|
@ -49,6 +49,9 @@ namespace Oyster { namespace Physics { namespace Formula
|
|||
::Oyster::Math::Float4 relativeMomentum = momB - momA;
|
||||
|
||||
::Oyster::Math::Float4 tanFriction = relativeMomentum - relativeMomentum.Dot( iN ) * iN;
|
||||
|
||||
if( tanFriction.Dot(tanFriction) > 0.0f )
|
||||
{ // no friction if moving directly into surface, or not at all.
|
||||
tanFriction.Normalize();
|
||||
|
||||
::Oyster::Math::Float magnitudeFriction = -relativeMomentum.Dot( tanFriction );
|
||||
|
@ -64,11 +67,14 @@ namespace Oyster { namespace Physics { namespace Formula
|
|||
else
|
||||
{
|
||||
::Oyster::Math::Float dynamicFriction = 0.5f * ( dFA + dFB );
|
||||
frictionImpulse = -i*tanFriction*dynamicFriction;
|
||||
frictionImpulse = ( -i * dynamicFriction ) * tanFriction;
|
||||
}
|
||||
|
||||
return ( 1 / mA ) * frictionImpulse;
|
||||
}
|
||||
else
|
||||
return ::Oyster::Math::Float4::null;
|
||||
}
|
||||
}
|
||||
|
||||
} } }
|
||||
|
|
Loading…
Reference in New Issue