physics
mouse_joint.hpp
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include "body.hpp"
8 
14 class MouseJoint {
15 public:
16 
17  vec3 bias = vec3(0,0,0);
18  mat3 effective_mass = mat3(0.0f);
19  vec3 P = vec3(0,0,0);
20 
23 
24  vec3 anchor_a;
25  vec3 anchor_b;
26 
29  vec3 prev_anchor_b = vec3(0,0,0);
30 
31  unsigned int body_a_index;
32  unsigned int body_b_index;
33 
34  bool unset = true;
35 
36  MouseJoint(unsigned int indexA, vec3 anchorA, vec3 anchorB);
37 
38  int setAnchor(vec3 anchor);
39  int setBodyAnchor(vec3 localPoint);
40 
41  int applyImpulse();
42 
43  int preStep(float dt);
44 
45  static vector<MouseJoint*> allJoints;
46 };
CollisionBody * body_a
Definition: mouse_joint.hpp:21
Mouse Joint, specifying an anchor in world-space and one on the body, will constrain the body at thos...
Definition: mouse_joint.hpp:14
unsigned int body_b_index
Definition: mouse_joint.hpp:32
mat3 effective_mass
Definition: mouse_joint.hpp:18
int preStep(float dt)
MouseJoint(unsigned int indexA, vec3 anchorA, vec3 anchorB)
vec3 anchor_b_ws
Definition: mouse_joint.hpp:28
int setAnchor(vec3 anchor)
vec3 anchor_a
Definition: mouse_joint.hpp:24
vec3 bias
Definition: mouse_joint.hpp:17
vec3 anchor_b
Definition: mouse_joint.hpp:25
vec3 P
Definition: mouse_joint.hpp:19
int applyImpulse()
CollisionBody * body_b
Definition: mouse_joint.hpp:22
int setBodyAnchor(vec3 localPoint)
unsigned int body_a_index
Definition: mouse_joint.hpp:31
static vector< MouseJoint * > allJoints
Definition: mouse_joint.hpp:45
CollisionBody structure for organising data to model physics simulations of convex hull collisions...
Definition: body.hpp:121
vec3 anchor_a_ws
Definition: mouse_joint.hpp:27
vec3 prev_anchor_b
Definition: mouse_joint.hpp:29
bool unset
Definition: mouse_joint.hpp:34