mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 17:35:45 +02:00
add CollisionInfo::getShapePairKey()
This commit is contained in:
parent
176d8d157d
commit
f579d2a0e2
2 changed files with 14 additions and 0 deletions
|
@ -26,6 +26,16 @@ CollisionInfo::CollisionInfo() :
|
|||
_addedVelocity(0.f) {
|
||||
}
|
||||
|
||||
quint64 CollisionInfo::getShapePairKey() const {
|
||||
if (_shapeB == NULL || _shapeA == NULL) {
|
||||
// zero is an invalid key
|
||||
return 0;
|
||||
}
|
||||
quint32 idA = _shapeA->getID();
|
||||
quint32 idB = _shapeB->getID();
|
||||
return idA < idB ? ((quint64)idA << 32) + (quint64)idB : ((quint64)idB << 32) + (quint64)idA;
|
||||
}
|
||||
|
||||
CollisionList::CollisionList(int maxSize) :
|
||||
_maxSize(maxSize),
|
||||
_size(0) {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QVector>
|
||||
|
||||
class Shape;
|
||||
|
@ -47,6 +48,9 @@ public:
|
|||
Shape* getShapeA() const { return const_cast<Shape*>(_shapeA); }
|
||||
Shape* getShapeB() const { return const_cast<Shape*>(_shapeB); }
|
||||
|
||||
/// \return unique key for shape pair
|
||||
quint64 getShapePairKey() const;
|
||||
|
||||
const Shape* _shapeA; // pointer to shapeA in this collision
|
||||
const Shape* _shapeB; // pointer to shapeB in this collision
|
||||
|
||||
|
|
Loading…
Reference in a new issue