Skip to content

Commit

Permalink
Fixed friction snapshot returning incorrect normals in some cases. Fi…
Browse files Browse the repository at this point in the history
…xes part of #29 (why did I not split this issue into 2)
  • Loading branch information
DrChat committed Jun 11, 2014
1 parent 089dbe2 commit f722c21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Physics_FrictionSnapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ void CPhysicsFrictionSnapshot::GetContactPoint(Vector &out) {

void CPhysicsFrictionSnapshot::GetSurfaceNormal(Vector &out) {
btManifoldPoint bullManifoldPoint = m_manifolds[m_iCurManifold]->getContactPoint(m_iCurContactPoint);
ConvertDirectionToHL(bullManifoldPoint.m_normalWorldOnB, out);
btVector3 norm = bullManifoldPoint.m_normalWorldOnB;

// Flip the normal so it's world on A (needs to be pointed away from m_pObject)
if (m_pObject->GetObject() == m_manifolds[m_iCurManifold]->getBody0())
norm *= -1;

ConvertDirectionToHL(norm, out); // The game expects the normal to point away from our object
}

float CPhysicsFrictionSnapshot::GetNormalForce() {
Expand Down

0 comments on commit f722c21

Please sign in to comment.