Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
ChipmunkConstraint.h
1 /* Copyright (c) 2013 Scott Lembcke and Howling Moon Software
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to deal
5  * in the Software without restriction, including without limitation the rights
6  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7  * copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19  * SOFTWARE.
20  */
21 
33 @interface ChipmunkConstraint : NSObject <ChipmunkBaseObject> {
34 @private
35  id _userData;
36 }
37 
39 @property(nonatomic, readonly) cpConstraint *constraint;
40 
42 @property(nonatomic, readonly) ChipmunkBody *bodyA;
43 
45 @property(nonatomic, readonly) ChipmunkBody *bodyB;
46 
49 +(ChipmunkConstraint *)constraintFromCPConstraint:(cpConstraint *)constraint;
50 
56 @property(nonatomic, assign) cpFloat maxForce;
57 
62 @property(nonatomic, assign) cpFloat errorBias;
63 
68 @property(nonatomic, assign) cpFloat maxBias;
69 
75 @property(nonatomic, assign) BOOL collideBodies;
76 
78 @property(nonatomic, readonly) cpFloat impulse;
79 
81 @property(nonatomic, readonly) ChipmunkSpace *space;
82 
87 @property(nonatomic, assign) id userData;
88 
90 -(void)preSolve:(ChipmunkSpace *)space;
91 
94 -(void)postSolve:(ChipmunkSpace *)space;
95 
96 @end
97 
98 
104 
109 + (ChipmunkPinJoint *)pinJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB;
110 
115 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB;
116 
118 @property(nonatomic, assign) cpVect anchorA;
119 
121 @property(nonatomic, assign) cpVect anchorB;
122 
124 @property(nonatomic, assign) cpFloat dist;
125 
126 @end
127 
128 
134 
138 + (ChipmunkSlideJoint *)slideJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB min:(cpFloat)min max:(cpFloat)max;
139 
143 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB min:(cpFloat)min max:(cpFloat)max;
144 
146 @property(nonatomic, assign) cpVect anchorA;
147 
149 @property(nonatomic, assign) cpVect anchorB;
150 
152 @property(nonatomic, assign) cpFloat min;
153 
155 @property(nonatomic, assign) cpFloat max;
156 
157 @end
158 
159 
164 
169 + (ChipmunkPivotJoint *)pivotJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB;
170 
174 + (ChipmunkPivotJoint *)pivotJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b pivot:(cpVect)pivot;
175 
180 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB;
181 
185 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b pivot:(cpVect)pivot;
186 
188 @property(nonatomic, assign) cpVect anchorA;
189 
191 @property(nonatomic, assign) cpVect anchorB;
192 
193 @end
194 
195 
200 
208 + (ChipmunkGrooveJoint *)grooveJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b grooveA:(cpVect)grooveA grooveB:(cpVect)grooveB anchorB:(cpVect)anchorB;
209 
217 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b grooveA:(cpVect)grooveA grooveB:(cpVect)grooveB anchorB:(cpVect)anchorB;
218 
220 @property(nonatomic, assign) cpVect grooveA;
222 @property(nonatomic, assign) cpVect grooveB;
223 
225 @property(nonatomic, assign) cpVect anchorB;
226 
227 @end
228 
229 
235 
242 + (ChipmunkDampedSpring *)dampedSpringWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB restLength:(cpFloat)restLength stiffness:(cpFloat)stiffness damping:(cpFloat)damping;
243 
250 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b anchorA:(cpVect)anchorA anchorB:(cpVect)anchorB restLength:(cpFloat)restLength stiffness:(cpFloat)stiffness damping:(cpFloat)damping;
251 
253 @property(nonatomic, assign) cpVect anchorA;
254 
256 @property(nonatomic, assign) cpVect anchorB;
257 
259 @property(nonatomic, assign) cpFloat restLength;
260 
262 @property(nonatomic, assign) cpFloat stiffness;
263 
265 @property(nonatomic, assign) cpFloat damping;
266 
267 @end
268 
269 
274 
275 
282 + (ChipmunkDampedRotarySpring *)dampedRotarySpringWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b restAngle:(cpFloat)restAngle stiffness:(cpFloat)stiffness damping:(cpFloat)damping;
283 
290 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b restAngle:(cpFloat)restAngle stiffness:(cpFloat)stiffness damping:(cpFloat)damping;
291 
293 @property(nonatomic, assign) cpFloat restAngle;
294 
296 @property(nonatomic, assign) cpFloat stiffness;
297 
299 @property(nonatomic, assign) cpFloat damping;
300 
301 @end
302 
303 
309 
314 + (ChipmunkRotaryLimitJoint *)rotaryLimitJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b min:(cpFloat)min max:(cpFloat)max;
315 
320 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b min:(cpFloat)min max:(cpFloat)max;
321 
323 @property(nonatomic, assign) cpFloat min;
324 
326 @property(nonatomic, assign) cpFloat max;
327 
328 @end
329 
330 
336 
338 + (ChipmunkSimpleMotor *)simpleMotorWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b rate:(cpFloat)rate;
339 
341 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b rate:(cpFloat)rate;
342 
344 @property(nonatomic, assign) cpFloat rate;
345 
346 @end
347 
348 
355 
361 + (ChipmunkGearJoint *)gearJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b phase:(cpFloat)phase ratio:(cpFloat)ratio;
362 
368 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b phase:(cpFloat)phase ratio:(cpFloat)ratio;
369 
371 @property(nonatomic, assign) cpFloat phase;
373 @property(nonatomic, assign) cpFloat ratio;
374 
375 @end
376 
381 
387 + (ChipmunkRatchetJoint *)ratchetJointWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b phase:(cpFloat)phase ratchet:(cpFloat)ratchet;
388 
394 - (id)initWithBodyA:(ChipmunkBody *)a bodyB:(ChipmunkBody *)b phase:(cpFloat)phase ratchet:(cpFloat)ratchet;
395 
397 @property(nonatomic, assign) cpFloat angle;
398 
400 @property(nonatomic, assign) cpFloat phase;
401 
403 @property(nonatomic, assign) cpFloat ratchet;
404 
405 @end