-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContact.h
More file actions
42 lines (30 loc) · 1.02 KB
/
Contact.h
File metadata and controls
42 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef CONTACT_H
#define CONTACT_H
#include <DirectXMath.h>
using namespace DirectX;
class Entity;
class Contact
{
friend class CollisionSystem;
public:
Contact(const XMFLOAT3 &contactPoint, const XMFLOAT3 &contactNormal, float penetration, Entity *entityA, Entity *entityB);
void CalculateContactData();
void ResolveVelocity(XMFLOAT3(&deltaLinearVelocity)[2], XMFLOAT3(&deltaAngularVelocity)[2]); // apply impulse
void ResolveInterpenetration(XMFLOAT3(&deltaPosition)[2], XMFLOAT3(&deltaOrientation)[2]); // apply displacement
private:
XMFLOAT3 CalculateFrictionlessImpulse();
XMFLOAT3 CalculateFrictionImpulse();
XMFLOAT3 mContactPoint;
XMFLOAT3 mContactNormal;
float mPenetration;
Entity *mEntities[2];
XMFLOAT3X3 mContactToWorldMatrix;
XMFLOAT3X3 mWorldToContactMatrix;
XMFLOAT3 mContactPointOffset[2];
XMFLOAT3X3 mContactPointOffsetSkewMatrix[2];
XMFLOAT3 mContactPointRelativeVelocityLocal;
float mDeltaClosingVelocity;
float mCoefficientOfRestitution;
float mFriction;
};
#endif // CONTACT_H