Physics4K  2013-06-04
Physics4K is the next great evolution in 2D physics engines. built upon the C++ Game Framework, it is going to take the next generation gaming world by storm.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Joint.h
Go to the documentation of this file.
1 // Filename: Joint.h
4 
5 //Preprocessor directive designed to cause the current source file to be included only once in a single compilation
6 #pragma once
7 
8 //Includes
9 #include "PKInclude.h"
10 #include "Shape.h"
11 #include "Vector2f.h"
12 #include "Matrix22.h"
13 #include "MathXtras.h"
14 
15 namespace PK
16 {
17  class PK_API Joint
18  {
19  public:
20  Joint(Shape* box1, Shape* box2, const Vector2f anchorPoint);
21  ~Joint();
22 
23  void Initialize(Shape* box1, Shape* box2, const Vector2f anchorPoint);
24 
25  void Update(float deltaTime);
26  void ApplyImpulse();
27 
28  void GetJointAnchors(Vector2f& box1Anchor, Vector2f& box2Anchor);
29 
30  private:
31  Shape* m_box1;
32  Shape* m_box2;
34  Vector2f m_box1Anchor;
35  Vector2f m_box2Anchor;
37  Vector2f m_box1RotatedAnchor;
38  Vector2f m_box2RotatedAnchor;
40  Matrix22 m_invK;
42  Vector2f m_bias;
43  float m_biasFactor;
44  };
45 }