mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:23:06 +02:00
fix for missed START collision events
This commit is contained in:
parent
89cc6ac315
commit
54b4612ee3
2 changed files with 9 additions and 9 deletions
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
void ContactInfo::update(uint32_t currentStep, const btManifoldPoint& p) {
|
void ContactInfo::update(uint32_t currentStep, const btManifoldPoint& p) {
|
||||||
_lastStep = currentStep;
|
_lastStep = currentStep;
|
||||||
++_numSteps;
|
|
||||||
positionWorldOnB = p.m_positionWorldOnB;
|
positionWorldOnB = p.m_positionWorldOnB;
|
||||||
normalWorldOnB = p.m_normalWorldOnB;
|
normalWorldOnB = p.m_normalWorldOnB;
|
||||||
distance = p.m_distance1;
|
distance = p.m_distance1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactEventType ContactInfo::computeType(uint32_t thisStep) {
|
ContactEventType ContactInfo::computeType(uint32_t thisStep) {
|
||||||
if (_lastStep != thisStep) {
|
++_numChecks;
|
||||||
return CONTACT_EVENT_TYPE_END;
|
if (_numChecks == 1) {
|
||||||
|
return CONTACT_EVENT_TYPE_START;
|
||||||
}
|
}
|
||||||
return (_numSteps == 1) ? CONTACT_EVENT_TYPE_START : CONTACT_EVENT_TYPE_CONTINUE;
|
return (_lastStep == thisStep) ? CONTACT_EVENT_TYPE_CONTINUE : CONTACT_EVENT_TYPE_END;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
class ContactInfo {
|
class ContactInfo {
|
||||||
public:
|
public:
|
||||||
void update(uint32_t currentStep, const btManifoldPoint& p);
|
void update(uint32_t currentStep, const btManifoldPoint& p);
|
||||||
ContactEventType computeType(uint32_t thisStep);
|
ContactEventType computeType(uint32_t thisStep);
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ public:
|
||||||
btVector3 normalWorldOnB;
|
btVector3 normalWorldOnB;
|
||||||
btScalar distance;
|
btScalar distance;
|
||||||
private:
|
private:
|
||||||
uint32_t _lastStep = 0;
|
uint32_t _lastStep { 0 };
|
||||||
uint32_t _numSteps = 0;
|
uint32_t _numChecks { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_ContactEvent_h
|
#endif // hifi_ContactEvent_h
|
||||||
|
|
Loading…
Reference in a new issue