linear collision response fix
moved improved version of Robin's implementation
This commit is contained in:
parent
c1c3b5e6af
commit
50b5b2dbf9
|
@ -38,6 +38,23 @@ namespace
|
||||||
Float protoG_Magnitude = protoG.Dot( normal ),
|
Float protoG_Magnitude = protoG.Dot( normal ),
|
||||||
deuterG_Magnitude = deuterG.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
|
// bounce
|
||||||
Float4 bounceD = normal * -Formula::CollisionResponse::Bounce( deuterState.GetRestitutionCoeff(),
|
Float4 bounceD = normal * -Formula::CollisionResponse::Bounce( deuterState.GetRestitutionCoeff(),
|
||||||
deuterState.GetMass(), deuterG_Magnitude,
|
deuterState.GetMass(), deuterG_Magnitude,
|
||||||
|
|
Loading…
Reference in New Issue