linear collision response fix

moved improved version of Robin's implementation
This commit is contained in:
Dander7BD 2014-01-14 09:12:37 +01:00
parent 727b2acb82
commit ee5e5ff8ce
1 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,23 @@ namespace
Float protoG_Magnitude = protoG.Dot( normal ),
deuterG_Magnitude = deuterG.Dot( normal );
// if they are not relatively moving towards eachother, there is no collision
Float deltaPos = normal.Dot( deuterState.GetCenterPosition() - protoState.GetCenterPosition() );
if( deltaPos < 0.0f )
{
if( protoG_Magnitude >= deuterG_Magnitude )
{
break;
}
}
else if( deltaPos > 0.0f )
{
if( protoG_Magnitude <= deuterG_Magnitude )
{
break;
}
}
// bounce
Float4 bounceD = normal * -Formula::CollisionResponse::Bounce( deuterState.GetRestitutionCoeff(),
deuterState.GetMass(), deuterG_Magnitude,