annotate trunk/chipmunkd/constraints/cpGrooveJoint.d @ 7:b68f10432182

some properties and some comments
author Extrawurst
date Thu, 02 Dec 2010 23:46:18 +0100
parents 707dd4e10c28
children c03a41d47b60
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
1
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
2 // written in the D programming language
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
3
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
4 module chipmunkd.constraints.cpGrooveJoint;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
5
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
6 import chipmunkd.chipmunk;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
7 import chipmunkd.constraints.util;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
8
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
9 //const cpConstraintClass *cpGrooveJointGetClass();
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
10
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
11 struct cpGrooveJoint {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
12 cpConstraint constraint;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
13 cpVect grv_n, grv_a, grv_b;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
14 cpVect anchr2;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
15
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
16 cpVect grv_tn;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
17 cpFloat clamp;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
18 cpVect r1, r2;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
19 cpVect k1, k2;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
20
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
21 cpVect jAcc;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
22 cpFloat jMaxLen;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
23 cpVect bias;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
24 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
25
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
26 //cpGrooveJoint *cpGrooveJointAlloc(void);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
27 //cpGrooveJoint *cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
28 //cpConstraint *cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
29 //
7
b68f10432182 some properties and some comments
Extrawurst
parents: 6
diff changeset
30 //TODO
6
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
31 //CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_a, GrooveA);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
32 //void cpGrooveJointSetGrooveA(cpConstraint *constraint, cpVect value);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
33 //CP_DefineConstraintGetter(cpGrooveJoint, cpVect, grv_b, GrooveB);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
34 //void cpGrooveJointSetGrooveB(cpConstraint *constraint, cpVect value);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
35 //CP_DefineConstraintProperty(cpGrooveJoint, cpVect, anchr2, Anchr2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
36
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
37 // cpGrooveJoint.c ---------------------------------
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
38
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
39 static void
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
40 preStep(cpGrooveJoint *joint, cpFloat dt, cpFloat dt_inv)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
41 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
42 mixin(CONSTRAINT_BEGIN!("joint", "a", "b"));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
43
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
44 // calculate endpoints in worldspace
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
45 cpVect ta = cpBodyLocal2World(a, joint.grv_a);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
46 cpVect tb = cpBodyLocal2World(a, joint.grv_b);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
47
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
48 // calculate axis
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
49 cpVect n = cpvrotate(joint.grv_n, a.rot);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
50 cpFloat d = cpvdot(ta, n);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
51
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
52 joint.grv_tn = n;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
53 joint.r2 = cpvrotate(joint.anchr2, b.rot);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
54
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
55 // calculate tangential distance along the axis of r2
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
56 cpFloat td = cpvcross(cpvadd(b.p, joint.r2), n);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
57 // calculate clamping factor and r2
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
58 if(td <= cpvcross(ta, n)){
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
59 joint.clamp = 1.0f;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
60 joint.r1 = cpvsub(ta, a.p);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
61 } else if(td >= cpvcross(tb, n)){
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
62 joint.clamp = -1.0f;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
63 joint.r1 = cpvsub(tb, a.p);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
64 } else {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
65 joint.clamp = 0.0f;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
66 joint.r1 = cpvsub(cpvadd(cpvmult(cpvperp(n), -td), cpvmult(n, d)), a.p);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
67 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
68
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
69 // Calculate mass tensor
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
70 k_tensor(a, b, joint.r1, joint.r2, &joint.k1, &joint.k2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
71
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
72 // compute max impulse
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
73 joint.jMaxLen = mixin(J_MAX!("joint", "dt"));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
74
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
75 // calculate bias velocity
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
76 cpVect delta = cpvsub(cpvadd(b.p, joint.r2), cpvadd(a.p, joint.r1));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
77 joint.bias = cpvclamp(cpvmult(delta, -joint.constraint.biasCoef*dt_inv), joint.constraint.maxBias);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
78
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
79 // apply accumulated impulse
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
80 apply_impulses(a, b, joint.r1, joint.r2, joint.jAcc);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
81 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
82
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
83 static cpVect
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
84 grooveConstrain(cpGrooveJoint *joint, cpVect j){
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
85 cpVect n = joint.grv_tn;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
86 cpVect jClamp = (joint.clamp*cpvcross(j, n) > 0.0f) ? j : cpvproject(j, n);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
87 return cpvclamp(jClamp, joint.jMaxLen);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
88 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
89
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
90 static void
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
91 applyImpulse(cpGrooveJoint *joint)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
92 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
93 mixin(CONSTRAINT_BEGIN!("joint", "a", "b"));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
94
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
95 cpVect r1 = joint.r1;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
96 cpVect r2 = joint.r2;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
97
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
98 // compute impulse
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
99 cpVect vr = relative_velocity(a, b, r1, r2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
100
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
101 cpVect j = mult_k(cpvsub(joint.bias, vr), joint.k1, joint.k2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
102 cpVect jOld = joint.jAcc;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
103 joint.jAcc = grooveConstrain(joint, cpvadd(jOld, j));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
104 j = cpvsub(joint.jAcc, jOld);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
105
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
106 // apply impulse
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
107 apply_impulses(a, b, joint.r1, joint.r2, j);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
108 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
109
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
110 static cpFloat
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
111 getImpulse(cpGrooveJoint *joint)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
112 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
113 return cpvlength(joint.jAcc);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
114 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
115
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
116 static /+const+/ cpConstraintClass klass = {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
117 cast(cpConstraintPreStepFunction)&preStep,
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
118 cast(cpConstraintApplyImpulseFunction)&applyImpulse,
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
119 cast(cpConstraintGetImpulseFunction)&getImpulse,
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
120 };
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
121 mixin(CP_DefineClassGetter!("cpGrooveJoint"));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
122
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
123 cpGrooveJoint *
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
124 cpGrooveJointAlloc()
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
125 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
126 return cast(cpGrooveJoint *)cpmalloc(cpGrooveJoint.sizeof);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
127 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
128
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
129 cpGrooveJoint *
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
130 cpGrooveJointInit(cpGrooveJoint *joint, cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
131 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
132 cpConstraintInit(cast(cpConstraint *)joint, &klass, a, b);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
133
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
134 joint.grv_a = groove_a;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
135 joint.grv_b = groove_b;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
136 joint.grv_n = cpvperp(cpvnormalize(cpvsub(groove_b, groove_a)));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
137 joint.anchr2 = anchr2;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
138
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
139 joint.jAcc = cpvzero;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
140
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
141 return joint;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
142 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
143
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
144 cpConstraint *
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
145 cpGrooveJointNew(cpBody *a, cpBody *b, cpVect groove_a, cpVect groove_b, cpVect anchr2)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
146 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
147 return cast(cpConstraint *)cpGrooveJointInit(cpGrooveJointAlloc(), a, b, groove_a, groove_b, anchr2);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
148 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
149
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
150 void
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
151 cpGrooveJointSetGrooveA(cpConstraint *constraint, cpVect value)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
152 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
153 cpGrooveJoint *g = cast(cpGrooveJoint *)constraint;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
154 //TODO:
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
155 //cpConstraintCheckCast(constraint, cpGrooveJoint);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
156
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
157 g.grv_a = value;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
158 g.grv_n = cpvperp(cpvnormalize(cpvsub(g.grv_b, value)));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
159
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
160 cpConstraintActivateBodies(constraint);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
161 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
162
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
163 void
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
164 cpGrooveJointSetGrooveB(cpConstraint *constraint, cpVect value)
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
165 {
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
166 cpGrooveJoint *g = cast(cpGrooveJoint *)constraint;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
167 //TODO:
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
168 //cpConstraintCheckCast(constraint, cpGrooveJoint);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
169
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
170 g.grv_b = value;
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
171 g.grv_n = cpvperp(cpvnormalize(cpvsub(value, g.grv_a)));
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
172
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
173 cpConstraintActivateBodies(constraint);
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
174 }
707dd4e10c28 ported rest of the constraints (chipmunk 5.3.2)
Extrawurst
parents:
diff changeset
175