Chipmunk2D Pro API Reference  7.0.3
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Instance Methods | Class Methods | Properties | List of all members
ChipmunkConstraint Class Reference

Constraints connect two ChipmunkBody objects together. More...

#import <ChipmunkConstraint.h>

Inherits NSObject, and <ChipmunkBaseObject>.

Inherited by ChipmunkDampedRotarySpring, ChipmunkDampedSpring, ChipmunkGearJoint, ChipmunkGrooveJoint, ChipmunkPinJoint, ChipmunkPivotJoint, ChipmunkRatchetJoint, ChipmunkRotaryLimitJoint, ChipmunkSimpleMotor, and ChipmunkSlideJoint.

Instance Methods

(void) - preSolve:
 Override this method to update a constraints parameters just before running the physics each step.
 
(void) - postSolve:
 Override this method to poll values from a constraint each frame after the physics runs. More...
 

Class Methods

(ChipmunkConstraint *) + constraintFromCPConstraint:
 Get the ChipmunkConstraint object associciated with a cpConstraint pointer. More...
 

Properties

cpConstraintconstraint
 Returns a pointer to the underlying cpConstraint C struct.
 
ChipmunkBodybodyA
 The first ChipmunkBody the constraint controls.
 
ChipmunkBodybodyB
 The second ChipmunkBody the constraint controls.
 
cpFloat maxForce
 Maximum force this constraint is allowed to use (defalts to infinity). More...
 
cpFloat errorBias
 The rate at which joint error is corrected. More...
 
cpFloat maxBias
 Maximum rate (speed) that a joint can be corrected at (defaults to infinity). More...
 
BOOL collideBodies
 Whether or not the connected bodies should checked for collisions. More...
 
cpFloat impulse
 Get the most recent impulse applied by this constraint.
 
ChipmunkSpacespace
 Get the space the body is added to.
 
id userData
 An object that this constraint is associated with. More...
 

Detailed Description

Constraints connect two ChipmunkBody objects together.

Most often constraints are simple joints, but can also be things like motors, friction generators or servos.

Method Documentation

+ (ChipmunkConstraint *) constraintFromCPConstraint: (cpConstraint *)  constraint

Get the ChipmunkConstraint object associciated with a cpConstraint pointer.

Undefined if the cpConstraint wasn't created using Objective-Chipmunk.

- (void) postSolve: (ChipmunkSpace *)  space

Override this method to poll values from a constraint each frame after the physics runs.

This can be used to implement breakable joints for instance.

Property Documentation

- (BOOL) collideBodies
readwritenonatomicassign

Whether or not the connected bodies should checked for collisions.

Collisions are filtered before calling callbacks. Defaults to TRUE.

- (cpFloat) errorBias
readwritenonatomicassign

The rate at which joint error is corrected.

Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

- (cpFloat) maxBias
readwritenonatomicassign

Maximum rate (speed) that a joint can be corrected at (defaults to infinity).

Setting this value to a finite value allows you to control a joint like a servo motor.

- (cpFloat) maxForce
readwritenonatomicassign

Maximum force this constraint is allowed to use (defalts to infinity).

This allows joints to be pulled apart if too much force is applied to them. It also allows you to use constraints as force or friction generators for controlling bodies.

- (id) userData
readwritenonatomicassign

An object that this constraint is associated with.

You can use this get a reference to your game object or controller object from within callbacks.

Attention
Like most delegate properties this is a weak reference and does not call retain. This prevents reference cycles from occuring.

The documentation for this class was generated from the following file: