X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?p=physics.git;a=blobdiff_plain;f=src%2FcollisionManager.cpp;h=72dcd6bd9fe9895c4e4a9cc4522a9e85133e08f5;hp=95a21935d877ce01b6597d222d39248ac6d97898;hb=e86c86b38b25bcb463943dc166b60f236aa4af10;hpb=19c2da50f7f1ce9854c718e6c1c545ccc2afbb5f diff --git a/src/collisionManager.cpp b/src/collisionManager.cpp index 95a2193..72dcd6b 100644 --- a/src/collisionManager.cpp +++ b/src/collisionManager.cpp @@ -228,8 +228,8 @@ void applyCollision(Ball* b1, Ball* b2) return; // a few values to simplify the equations - const Vector2& normal = cInfo.normal; - const Vector2& point = cInfo.point; + const Vector2& normal = cInfo.m_vecNormal; + const Vector2& point = cInfo.m_vecPoint; float m1 = b1->mass; float m2 = b2->mass; @@ -259,7 +259,7 @@ void applyCollision(Polygon* pPoly, Ball* pBall) return; float fCoR = pBall->CoR; - Vector2 vecNorm = cInfo.normal; + Vector2 vecNorm = cInfo.m_vecNormal; Vector2 vecVelo = pBall->velocityRaw(); @@ -274,7 +274,7 @@ void applyCollision(Polygon* pPoly, Ball* pBall) // from center to point Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->radius; - pBall->applyNudge(cInfo.point + vecCollP - pBall->positionRaw()); + pBall->applyNudge(cInfo.m_vecPoint + vecCollP - pBall->positionRaw()); } bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo) @@ -305,8 +305,8 @@ bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo) if ((v1 - v2).dot(p1 - p2) >= 0) return false; - pcInfo->point = p1 - (p1 - p2) * r1 / (r1 + r2); - pcInfo->normal = p1 - p2; + pcInfo->m_vecPoint = p1 - (p1 - p2) * r1 / (r1 + r2); + pcInfo->m_vecNormal = p1 - p2; return true; } @@ -356,8 +356,8 @@ bool getInfo(const Polygon* pPoly, const Ball* pBall, CollisionInfo* pcInfo) return false; - pcInfo->point = vecTotVec / iTot + vecPos; - pcInfo->normal = vecPos - pcInfo->point; + pcInfo->m_vecPoint = vecTotVec / iTot + vecPos; + pcInfo->m_vecNormal = vecPos - pcInfo->m_vecPoint; return true; }