projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor of CollisionInfo
[physics.git]
/
src
/
collisionManager.cpp
diff --git
a/src/collisionManager.cpp
b/src/collisionManager.cpp
index
95a2193
..
72dcd6b
100644
(file)
--- 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
return;
// a few values to simplify the equations
- const Vector2& normal = cInfo.
n
ormal;
- const Vector2& point = cInfo.
p
oint;
+ const Vector2& normal = cInfo.
m_vecN
ormal;
+ const Vector2& point = cInfo.
m_vecP
oint;
float m1 = b1->mass;
float m2 = b2->mass;
float m1 = b1->mass;
float m2 = b2->mass;
@@
-259,7
+259,7
@@
void applyCollision(Polygon* pPoly, Ball* pBall)
return;
float fCoR = pBall->CoR;
return;
float fCoR = pBall->CoR;
- Vector2 vecNorm = cInfo.
n
ormal;
+ Vector2 vecNorm = cInfo.
m_vecN
ormal;
Vector2 vecVelo = pBall->velocityRaw();
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;
// from center to point
Vector2 vecCollP = vecNorm / vecNorm.length() * pBall->radius;
- pBall->applyNudge(cInfo.
p
oint + vecCollP - pBall->positionRaw());
+ pBall->applyNudge(cInfo.
m_vecP
oint + vecCollP - pBall->positionRaw());
}
bool getInfo(const Ball* b1, const Ball* b2, CollisionInfo* pcInfo)
}
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;
if ((v1 - v2).dot(p1 - p2) >= 0)
return false;
- pcInfo->
p
oint = p1 - (p1 - p2) * r1 / (r1 + r2);
- pcInfo->
n
ormal = p1 - p2;
+ pcInfo->
m_vecP
oint = p1 - (p1 - p2) * r1 / (r1 + r2);
+ pcInfo->
m_vecN
ormal = p1 - p2;
return true;
}
return true;
}
@@
-356,8
+356,8
@@
bool getInfo(const Polygon* pPoly, const Ball* pBall, CollisionInfo* pcInfo)
return false;
return false;
- pcInfo->
p
oint = vecTotVec / iTot + vecPos;
- pcInfo->
normal = vecPos - pcInfo->p
oint;
+ pcInfo->
m_vecP
oint = vecTotVec / iTot + vecPos;
+ pcInfo->
m_vecNormal = vecPos - pcInfo->m_vecP
oint;
return true;
}
return true;
}