/// ***** Private Method Headers *****
-void applyCollisionAt(PhysicsEntity* p1, PhysicsEntity* p2, float time_step);
-void applyCollisionAt(Ball* b1, Ball* b2, float time_step);
+void applyCollisionAt(PhysicsEntity* p1, PhysicsEntity* p2);
+void applyCollisionAt(Ball* b1, Ball* b2);
-CollisionInfo* getInfoAt(Ball* b1, Ball* b2, float time_step);
+CollisionInfo* getInfoAt(Ball* b1, Ball* b2);
/// ***** Private Variables *****
/// ***** Public Methods *****
-void collision::update(setPhys sp, float time_step)
+void collision::update(setPhys& sp)
{
for( setPhys::iterator it1 = sp.begin();
it1 != sp.end();
{
if( *it1 != *it2 )
{
- applyCollisionAt(*it1, *it2, time_step);
+ applyCollisionAt(*it1, *it2);
}
}
}
/// ***** Private Methods *****
-void applyCollisionAt(PhysicsEntity* p1, PhysicsEntity* p2, float time_step)
+void applyCollisionAt(PhysicsEntity* p1, PhysicsEntity* p2)
{
Ball* b1 = dynamic_cast<Ball*>(p1);
Ball* b2 = dynamic_cast<Ball*>(p2);
if( b1 != NULL && b2 != NULL )
{
- applyCollisionAt(b1, b2, time_step);
+ applyCollisionAt(b1, b2);
return;
}
#endif
}
-void applyCollisionAt(Ball* b1, Ball* b2, float time_step)
+void applyCollisionAt(Ball* b1, Ball* b2)
{
// /*
- CollisionInfo* info = getInfoAt(b1, b2, time_step);
+ CollisionInfo* info = getInfoAt(b1, b2);
if(info == NULL)
return;
float e = (b1->CoR + b2->CoR) / 2;
- Vector2 v1 = b1->velocityAt(time_step);
- Vector2 v2 = b2->velocityAt(time_step);
+ Vector2 v1 = b1->velocityRaw();
+ Vector2 v2 = b2->velocityRaw();
float iTop = -(e + 1) * (v1 - v2).dot(normal);
// */
}
-CollisionInfo* getInfoAt(Ball* b1, Ball* b2, float time_step)
+CollisionInfo* getInfoAt(Ball* b1, Ball* b2)
{
// a few values to simplify the equations
float r1 = b1->radius;
float r2 = b2->radius;
- Vector2 p1 = b1->positionAt(time_step);
- Vector2 p2 = b2->positionAt(time_step);
- Vector2 v1 = b1->velocityAt(time_step);
- Vector2 v2 = b2->velocityAt(time_step);
+ Vector2 p1 = b1->positionRaw();
+ Vector2 p2 = b2->positionRaw();
+ Vector2 v1 = b1->velocityRaw();
+ Vector2 v2 = b2->velocityRaw();
// quick binding box check
if (p1.x - r1 > p2.x + r2