fixed polygon penitration due to CoR
[physics.git] / src / collisionManager.cpp
index 8aa2dc7..95a2193 100644 (file)
@@ -273,8 +273,8 @@ void applyCollision(Polygon* pPoly, Ball* pBall)
     // CoR penetration fix, adds the jitters
 
     // from center to point
-    //Vector2 CollP = normal / normal.Length * Ball.Radius;
-    //Ball.Position = Info.Point + CollP;
+    Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->radius;
+    pBall->applyNudge(cInfo.point + vecCollP - pBall->positionRaw());
 }
 
 bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo)