Overte C++ Documentation
ContactInfo.h
1 //
2 // ContactEvent.h
3 // libraries/physics/src
4 //
5 // Created by Andrew Meadows 2015.01.20
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_ContactEvent_h
13 #define hifi_ContactEvent_h
14 
15 #include <btBulletDynamicsCommon.h>
16 #include <glm/glm.hpp>
17 
18 #include "RegisteredMetaTypes.h"
19 
20 
21 class ContactInfo {
22 public:
23  void update(uint32_t currentStep, const btManifoldPoint& p);
24  ContactEventType computeType(uint32_t thisStep);
25 
26  const btVector3& getPositionWorldOnB() const { return positionWorldOnB; }
27  btVector3 getPositionWorldOnA() const { return positionWorldOnB + normalWorldOnB * distance; }
28 
29  bool readyForContinue(uint32_t thisStep);
30 
31  btVector3 positionWorldOnB;
32  btVector3 normalWorldOnB;
33  btScalar distance;
34 private:
35  uint32_t _lastStep { 0 };
36  uint32_t _continueExpiry { 0 };
37 };
38 
39 
40 #endif // hifi_ContactEvent_h