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

Gear joints constrain the rotational speed of one body to another. More...

#import <ChipmunkConstraint.h>

Inherits ChipmunkConstraint.

Instance Methods

(id) - initWithBodyA:bodyB:phase:ratio:
 Initialize a gear joint between the given bodies. More...
 
- Instance Methods inherited from ChipmunkConstraint
(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

(ChipmunkGearJoint *) + gearJointWithBodyA:bodyB:phase:ratio:
 Create an autoreleased gear joint between the given bodies. More...
 
- Class Methods inherited from ChipmunkConstraint
(ChipmunkConstraint *) + constraintFromCPConstraint:
 Get the ChipmunkConstraint object associciated with a cpConstraint pointer. More...
 

Properties

cpFloat phase
 The angular offset in radians.
 
cpFloat ratio
 The ratio of the rotational speeds.
 
- Properties inherited from ChipmunkConstraint
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

Gear joints constrain the rotational speed of one body to another.

A ratio of 1.0 will lock the rotation of two bodies together, and negative ratios will cause them to spin in opposite directions. You can also use gear joints as rotary servos by setting ChipmunkConstraint.maxForce and ChipmunkConstraint.maxBias to finite values and changing the ChipmunkGearJoint.phase property.

Method Documentation

+ (ChipmunkGearJoint *) gearJointWithBodyA: (ChipmunkBody *)  a
bodyB: (ChipmunkBody *)  b
phase: (cpFloat phase
ratio: (cpFloat ratio 

Create an autoreleased gear joint between the given bodies.

Parameters
phaseThe angular offset.
ratioThe ratio of the rotational speeds.
- (id) initWithBodyA: (ChipmunkBody *)  a
bodyB: (ChipmunkBody *)  b
phase: (cpFloat phase
ratio: (cpFloat ratio 

Initialize a gear joint between the given bodies.

Parameters
phaseThe angular offset in radians.
ratioThe ratio of the rotational speeds.

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