SpaceManager Class Reference
Inherits from | NSObject |
Declared in | SpaceManager.h SpaceManager.mm |
Overview
The SpaceManager
Space Manager
SpaceManager.m
Manage the space for the application
http://www.mobile-bros.com
Created by Robert Blackwood on 02/22/2009.
Copyright 2009 Mobile Bros. All rights reserved.
Tasks
Other Methods
-
space
The actual chipmunk space
property -
leftWall
The segment shapes that form the bounds of the window
property -
steps
Number of steps (across dt) perform on each step call
property -
lastDt
The dt value that was used in step last
property -
gravity
The gravity of the space
property -
damping
The damping of the space (viscousity in “air”)
property -
rehashStaticEveryStep
If this is set to YES/TRUE then step will call rehashStatic before stepping
property -
iterateFunc
Set the iterateFunc; the function that will use “eachFunc” to sync chipmunk values
property -
eachFunc
Set the iterateFunc; the default will update cocosnodes for pos and rotation
property -
staticBody
A staticBody for any particular reusable purpose
property -
isSpaceLocked
Whether or not this space is internally locked
property -
constantDt
If this is set to anything other than zero, the step routine will use its value as the dt (constant)
property -
cleanupBodyDependencies
Setting this to YES/TRUE will also free contraints connected to a free’d shape
property -
constraintCleanupDelegate
This will be called from all methods that auto-free constraints dependent on bodies being freed
property -
+ spaceManager
Default creation method
-
+ spaceManagerWithSize:count:
Creation method
-
+ spaceManagerWithSpace:
-
– initWithSize:count:
Initialization method
-
– initWithSpace:
-
– loadSpaceFromUserDocs:delegate:
load a cpSerializer file from a user docs file, delegate can be nil
-
– saveSpaceToUserDocs:delegate:
save a cpSerializer file to a user docs file, delegate can be nil
-
– loadSpaceFromPath:delegate:
load a cpSerializer file from a file (path), delegate can be nil
-
– saveSpaceToPath:delegate:
save a cpSerializer file to a resource file (path), delegate can be nil
-
– loadedShapeForId:
after a load from a file, use this to retrieve a shape from it’s id in the file
-
– loadedBodyForId:
after a load from a file, use this to retrieve a shape from it’s id in the file
-
– addWindowContainmentWithFriction:elasticity:size:inset:radius:
-
– addWindowContainmentWithFriction:elasticity:rect:inset:radius:
-
– step:
Manually advance time within the space
-
– addCircleAt:mass:radius:
add a circle shape
-
– addCircleToBody:radius:
add a circle shape to existing body
-
– addCircleToBody:radius:offset:
add a circle shape to existing body, with offset
-
– addRectAt:mass:width:height:rotation:
add a rectangle shape
-
– addRectToBody:width:height:rotation:
add a rectangle shape to existing body
-
– addRectToBody:width:height:rotation:offset:
add a rectangle shape to existing body, with offset
-
– addPolyAt:mass:rotation:numPoints:points:
add a polygon shape, convenience method
-
– addPolyAt:mass:rotation:points:
add a polygon shape
-
– addPolyAt:mass:rotation:numPoints:pointsArray:
add a polygon shape
-
– addPolyToBody:rotation:points:
add a polygon shape to existing body
-
– addPolyToBody:rotation:points:offset:
add a polygon shape to existing body, with offset
-
– addPolyToBody:rotation:numPoints:pointsArray:
Alternative, add a polygon shape to existing body
-
– addPolyToBody:rotation:numPoints:pointsArray:offset:
Alternative, add a polygon shape to existing body, with offset
-
– addSegmentAtWorldAnchor:toWorldAnchor:mass:radius:
-
– addSegmentAt:fromLocalAnchor:toLocalAnchor:mass:radius:
-
– addSegmentToBody:fromLocalAnchor:toLocalAnchor:radius:
-
– getShapeAt:layers:group:
Retrieve the first shape found at this position matching layers and group
-
– getShapeAt:
Retrieve the first shape found at this position
-
– rehashActiveShapes
Use if you need to call getShapes before you’ve actually started simulating
-
– rehashStaticShapes
Use if you move static shapes during simulation
-
– rehashShape:
Use to only rehash one shape
-
– getShapesAt:layers:group:
Given a point, return an array of NSValues with a pointer to a cpShape
-
– getShapesAt:
getShapesAt:layers:group:
-
– getShapesAt:radius:layers:group:
Given a point and a radius, return an array of NSValues with a pointer to a cpShape
-
– getShapesAt:radius:
getShapesAt:radius:layers:group:
-
– getShapesOnBody:
Get shapes that are using this body
-
– getShapeFromRayCastSegment:end:layers:group:
Return first shape hit by the given raycast
-
– getShapeFromRayCastSegment:end:
see getShapeFromRayCastSegment:end:layers:group:
-
– getInfoFromRayCastSegment:end:layers:group:
Return the info on the first shape hit by the given raycast
-
– getInfoFromRayCastSegment:end:
see getInfoFromRayCastSegment:end:layers:group:
-
– getShapesFromRayCastSegment:end:layers:group:
Return an array of NSValues with a pointer to a cpShape that intersects the raycast
-
– getShapesFromRayCastSegment:end:
see getShapesFromRayCastSegment:end:layers:group:
-
– getInfosFromRayCastSegment:end:layers:group:
Return an array of NSValues with a pointer to a cpSegmentQueryInfo, this array will clean up the infos when released
-
– getInfosFromRayCastSegment:end:
see getInfosFromRayCastSegment:end:layers:group:
-
– applyLinearExplosionAt:radius:maxForce:
Explosion, applied linear force to objects within radius
-
– applyLinearExplosionAt:radius:maxForce:layers:group:
Explosion, applied linear force to objects within radius given a group and layer(s)
-
– isPersistentContactOnShape:contactShape:
Queries the space as to whether these two shapes are in persistent contact
-
– persistentContactInfoOnShape:
Queries the space as to whether this shape has a persistent contact, returns the first arbiter info
-
– persistentContactInfosOnShape:
Queries the space as to whether this shape has a persistent contact, returns the all arbiters
-
– persistentContactOnShape:
Queries the space as to whether this shape has ANY persistent contact, It will return the first shape it finds or NULL if nothing is found
-
– getConstraints
Will return an array of NSValues that point to the cpConstraints
-
– getConstraintsOnBody:
Will return an array of NSValues that point to the cpConstraints on given body
-
– removeAndFreeShape:
Use when removing & freeing a shape AND it’s body if the body is not used by other shapes
-
– removeShape:
Use when removing a shape, will pass ownership to caller
-
– addShape:
Manually add a shape to the space
-
– removeAndFreeBody:
Use when removing & freeing a body
-
– removeBody:
Use when removing a body, will pass ownership to caller
-
– addBody:
Manually add a body to the space
-
– isBodyShared:
Check is body belongs to more than one shape
-
– shapesOnBody:
Count shapes on body
-
– morphShapeToStatic:
This will force a shape into a static shape
-
– morphShapeToActive:mass:
This will force a shape active and give it the given mass
-
– morphShapeToKinematic:
This will force a shape to be kinematic (body will not simulate)
-
– fragmentShape:piecesNum:eachMass:
This will take a shape (any) and split it into the number of pieces you specify,
-
– fragmentRect:rowPiecesNum:colPiecesNum:eachMass:
This will take a rect and split it into the number of pieces (Rows x Cols) you specify,
-
– fragmentCircle:piecesNum:eachMass:
This will take a circle and split it into the number of pieces you specify,
-
– fragmentSegment:piecesNum:eachMass:
This will take a segment and split it into the number of pieces you specify,
-
– combineShapes:
Combine two shapes together by combining their bodies into one
-
– offsetShape:offset:
Offset shape from body using (circle:center, segment:endpoints, poly:vertices)
-
– ignoreCollisionBetweenType:otherType:
Unique Collision: will ignore the effects a collsion between types
-
– addCollisionCallbackBetweenType:otherType:target:selector:
Register a collision callback between types
-
– addCollisionCallbackBetweenType:otherType:target:selector:moments:
Register a collision callback between types for the given collision moments
-
– removeCollisionCallbackBetweenType:otherType:
Unregister a collision callback between types
-
– addConstraint:
Use when adding created constraints
-
– removeConstraint:
Use when removing constraints, ownership is given to caller
-
– removeAndFreeConstraint:
This will remove and free the constraint
-
– removeAndFreeConstraintsOnBody:
This will calculate all constraints on a body and remove & free them
-
– addSpringToBody:fromBody:toBodyAnchor:fromBodyAnchor:restLength:stiffness:damping:
Add a spring to two bodies at the body anchor points
-
– addSpringToBody:fromBody:restLength:stiffness:damping:
Add a spring to two bodies at the body anchor points
-
– addSpringToBody:fromBody:stiffness:
Add a spring to two bodies at the body anchor points
-
– addGrooveToBody:fromBody:grooveAnchor1:grooveAnchor2:fromBodyAnchor:
Add a groove (aka sliding pin) between two bodies
-
– addGrooveToBody:fromBody:grooveLength:isHorizontal:fromBodyAnchor:
Add a groove (aka sliding pin) between two bodies
-
– addGrooveToBody:fromBody:grooveLength:isHorizontal:
Add a groove (aka sliding pin) between two bodies
-
– addSlideToBody:fromBody:toBodyAnchor:fromBodyAnchor:minLength:maxLength:
Add a sliding joint between two bodies
-
– addSlideToBody:fromBody:toBodyAnchor:fromBodyAnchor:minLength:
Add a sliding joint between two bodies, calculating max length
-
– addSlideToBody:fromBody:minLength:maxLength:
Add a sliding joint between two bodies
-
– addPinToBody:fromBody:toBodyAnchor:fromBodyAnchor:
Create a pin (rod) between two bodies
-
– addPinToBody:fromBody:
Create a pin (rod) between two bodies
-
– addPivotToBody:fromBody:toBodyAnchor:fromBodyAnchor:
Add a shared point between two bodies that they may rotate around
-
– addPivotToBody:fromBody:worldAnchor:
Add a shared point between two bodies that they may rotate around
-
– addPivotToBody:fromBody:
Add a shared point between two bodies that they may rotate around
-
– addMotorToBody:fromBody:rate:
Add a motor that applys torque to a specified body(s)
-
– addMotorToBody:rate:
Add a motor that applys torque to a specified body(s)
-
– addGearToBody:fromBody:phase:ratio:
Add gears between two bodies
-
– addGearToBody:fromBody:ratio:
Add gears between two bodies
-
– addBreakableToConstraint:maxForce:
This does not work yet
-
– addRotaryLimitToBody:fromBody:min:max:
Specify a min and a max a body can rotate relative to another body
-
– addRotaryLimitToBody:min:max:
Specify a min and a max a body can rotate
-
– addRatchetToBody:fromBody:phase:rachet:
Add a ratchet between two bodies
-
– addRatchetToBody:phase:rachet:
Add a ratchet to a body
-
– addRotarySpringToBody:fromBody:restAngle:stiffness:damping:
Add a rotary spring between two bodies
-
– addRotarySpringToBody:restAngle:stiffness:damping:
Add a rotary spring to a body
-
– addPulleyToBody:fromBody:pulleyBody:toBodyAnchor:fromBodyAnchor:toPulleyAnchor:fromPulleyAnchor:ratio:
Add a pulley between two bodies and another body which is the actual pulley
-
– addPulleyToBody:fromBody:toBodyAnchor:fromBodyAnchor:toPulleyWorldAnchor:fromPulleyWorldAnchor:ratio:
Add a pulley between two bodies
Other Methods
Properties
cleanupBodyDependencies
Setting this to YES/TRUE will also free contraints connected to a free’d shape
@property (readwrite, assign) BOOL cleanupBodyDependencies
Declared In
SpaceManager.h
constantDt
If this is set to anything other than zero, the step routine will use its value as the dt (constant)
@property (readwrite, assign) cpFloat constantDt
Declared In
SpaceManager.h
constraintCleanupDelegate
This will be called from all methods that auto-free constraints dependent on bodies being freed
@property (readwrite, retain) id<cpConstraintCleanupDelegate> constraintCleanupDelegate
Declared In
SpaceManager.h
damping
The damping of the space (viscousity in “air”)
@property (readwrite, assign) cpFloat damping
Declared In
SpaceManager.h
eachFunc
Set the iterateFunc; the default will update cocosnodes for pos and rotation
@property (readwrite, assign) smgrEachFunc eachFunc
Declared In
SpaceManager.h
gravity
The gravity of the space
@property (readwrite, assign) cpVect gravity
Declared In
SpaceManager.h
isSpaceLocked
Whether or not this space is internally locked
@property (readonly) BOOL isSpaceLocked
Declared In
SpaceManager.h
iterateFunc
Set the iterateFunc; the function that will use “eachFunc” to sync chipmunk values
@property (readwrite, assign) smgrIterateFunc iterateFunc
Declared In
SpaceManager.h
lastDt
The dt value that was used in step last
@property (readonly) cpFloat lastDt
Declared In
SpaceManager.h
leftWall
The segment shapes that form the bounds of the window
@property (readwrite, assign) cpShape *, *, *, *leftWall
Declared In
SpaceManager.h
rehashStaticEveryStep
If this is set to YES/TRUE then step will call rehashStatic before stepping
@property (readwrite, assign) BOOL rehashStaticEveryStep
Declared In
SpaceManager.h
Class Methods
Instance Methods
addBreakableToConstraint:maxForce:
This does not work yet
- (cpConstraint *)addBreakableToConstraint:(cpConstraint *)breakConstraint maxForce:(cpFloat)max
Declared In
SpaceManager.h
addCircleAt:mass:radius:
add a circle shape
- (cpShape *)addCircleAt:(cpVect)pos mass:(cpFloat)mass radius:(cpFloat)radius
Declared In
SpaceManager.h
addCircleToBody:radius:
add a circle shape to existing body
- (cpShape *)addCircleToBody:(cpBody *)body radius:(cpFloat)radius
Declared In
SpaceManager.h
addCircleToBody:radius:offset:
add a circle shape to existing body, with offset
- (cpShape *)addCircleToBody:(cpBody *)body radius:(cpFloat)radius offset:(CGPoint)offset
Declared In
SpaceManager.h
addCollisionCallbackBetweenType:otherType:target:selector:
Register a collision callback between types
- (void)addCollisionCallbackBetweenType:(unsigned int)type1 otherType:(unsigned int)type2 target:(id)target selector:(SEL)selector
Declared In
SpaceManager.h
addCollisionCallbackBetweenType:otherType:target:selector:moments:
Register a collision callback between types for the given collision moments
- (void)addCollisionCallbackBetweenType:(unsigned int)type1 otherType:(unsigned int)type2 target:(id)target selector:(SEL)selector moments:(CollisionMoment)moment, ...
Declared In
SpaceManager.h
addConstraint:
Use when adding created constraints
- (void)addConstraint:(cpConstraint *)constraint
Declared In
SpaceManager.h
addGearToBody:fromBody:phase:ratio:
Add gears between two bodies
- (cpConstraint *)addGearToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody phase:(cpFloat)phase ratio:(cpFloat)ratio
Declared In
SpaceManager.h
addGearToBody:fromBody:ratio:
Add gears between two bodies
- (cpConstraint *)addGearToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody ratio:(cpFloat)ratio
Declared In
SpaceManager.h
addGrooveToBody:fromBody:grooveAnchor1:grooveAnchor2:fromBodyAnchor:
Add a groove (aka sliding pin) between two bodies
- (cpConstraint *)addGrooveToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody grooveAnchor1:(cpVect)groove1 grooveAnchor2:(cpVect)groove2 fromBodyAnchor:(cpVect)anchor2
Declared In
SpaceManager.h
addGrooveToBody:fromBody:grooveLength:isHorizontal:
Add a groove (aka sliding pin) between two bodies
- (cpConstraint *)addGrooveToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody grooveLength:(cpFloat)length isHorizontal:(bool)horiz
Declared In
SpaceManager.h
addGrooveToBody:fromBody:grooveLength:isHorizontal:fromBodyAnchor:
Add a groove (aka sliding pin) between two bodies
- (cpConstraint *)addGrooveToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody grooveLength:(cpFloat)length isHorizontal:(bool)horiz fromBodyAnchor:(cpVect)anchor2
Declared In
SpaceManager.h
addMotorToBody:fromBody:rate:
Add a motor that applys torque to a specified body(s)
- (cpConstraint *)addMotorToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody rate:(cpFloat)rate
Declared In
SpaceManager.h
addMotorToBody:rate:
Add a motor that applys torque to a specified body(s)
- (cpConstraint *)addMotorToBody:(cpBody *)toBody rate:(cpFloat)rate
Declared In
SpaceManager.h
addPinToBody:fromBody:
Create a pin (rod) between two bodies
- (cpConstraint *)addPinToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody
Declared In
SpaceManager.h
addPinToBody:fromBody:toBodyAnchor:fromBodyAnchor:
Create a pin (rod) between two bodies
- (cpConstraint *)addPinToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchr1 fromBodyAnchor:(cpVect)anchr2
Declared In
SpaceManager.h
addPivotToBody:fromBody:
Add a shared point between two bodies that they may rotate around
- (cpConstraint *)addPivotToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody
Declared In
SpaceManager.h
addPivotToBody:fromBody:toBodyAnchor:fromBodyAnchor:
Add a shared point between two bodies that they may rotate around
- (cpConstraint *)addPivotToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchr1 fromBodyAnchor:(cpVect)anchr2
Declared In
SpaceManager.h
addPivotToBody:fromBody:worldAnchor:
Add a shared point between two bodies that they may rotate around
- (cpConstraint *)addPivotToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody worldAnchor:(cpVect)anchr
Declared In
SpaceManager.h
addPolyAt:mass:rotation:numPoints:points:
add a polygon shape, convenience method
- (cpShape *)addPolyAt:(cpVect)pos mass:(cpFloat)mass rotation:(cpFloat)r numPoints:(int)numPoints points:(cpVect)pt, ...
Declared In
SpaceManager.h
addPolyAt:mass:rotation:numPoints:pointsArray:
add a polygon shape
- (cpShape *)addPolyAt:(cpVect)pos mass:(cpFloat)mass rotation:(cpFloat)r numPoints:(int)numPoints pointsArray:(cpVect *)points
Declared In
SpaceManager.h
addPolyAt:mass:rotation:points:
add a polygon shape
- (cpShape *)addPolyAt:(cpVect)pos mass:(cpFloat)mass rotation:(cpFloat)r points:(NSArray *)points
Declared In
SpaceManager.h
addPolyToBody:rotation:numPoints:pointsArray:
Alternative, add a polygon shape to existing body
- (cpShape *)addPolyToBody:(cpBody *)body rotation:(cpFloat)r numPoints:(int)numPoints pointsArray:(cpVect *)points
Declared In
SpaceManager.h
addPolyToBody:rotation:numPoints:pointsArray:offset:
Alternative, add a polygon shape to existing body, with offset
- (cpShape *)addPolyToBody:(cpBody *)body rotation:(cpFloat)r numPoints:(int)numPoints pointsArray:(cpVect *)points offset:(CGPoint)offset
Declared In
SpaceManager.h
addPolyToBody:rotation:points:
add a polygon shape to existing body
- (cpShape *)addPolyToBody:(cpBody *)body rotation:(cpFloat)r points:(NSArray *)points
Declared In
SpaceManager.h
addPolyToBody:rotation:points:offset:
add a polygon shape to existing body, with offset
- (cpShape *)addPolyToBody:(cpBody *)body rotation:(cpFloat)r points:(NSArray *)points offset:(CGPoint)offset
Declared In
SpaceManager.h
addPulleyToBody:fromBody:pulleyBody:toBodyAnchor:fromBodyAnchor:toPulleyAnchor:fromPulleyAnchor:ratio:
Add a pulley between two bodies and another body which is the actual pulley
- (cpConstraint *)addPulleyToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody pulleyBody:(cpBody *)pulleyBody toBodyAnchor:(cpVect)anchor1 fromBodyAnchor:(cpVect)anchor2 toPulleyAnchor:(cpVect)anchor3a fromPulleyAnchor:(cpVect)anchor3b ratio:(cpFloat)ratio
Declared In
SpaceManager.h
addPulleyToBody:fromBody:toBodyAnchor:fromBodyAnchor:toPulleyWorldAnchor:fromPulleyWorldAnchor:ratio:
Add a pulley between two bodies
- (cpConstraint *)addPulleyToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchor1 fromBodyAnchor:(cpVect)anchor2 toPulleyWorldAnchor:(cpVect)anchor3a fromPulleyWorldAnchor:(cpVect)anchor3b ratio:(cpFloat)ratio
Declared In
SpaceManager.h
addRatchetToBody:fromBody:phase:rachet:
Add a ratchet between two bodies
- (cpConstraint *)addRatchetToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody phase:(cpFloat)phase rachet:(cpFloat)ratchet
Declared In
SpaceManager.h
addRatchetToBody:phase:rachet:
Add a ratchet to a body
- (cpConstraint *)addRatchetToBody:(cpBody *)toBody phase:(cpFloat)phase rachet:(cpFloat)ratchet
Declared In
SpaceManager.h
addRectAt:mass:width:height:rotation:
add a rectangle shape
- (cpShape *)addRectAt:(cpVect)pos mass:(cpFloat)mass width:(cpFloat)width height:(cpFloat)height rotation:(cpFloat)r
Declared In
SpaceManager.h
addRectToBody:width:height:rotation:
add a rectangle shape to existing body
- (cpShape *)addRectToBody:(cpBody *)body width:(cpFloat)width height:(cpFloat)height rotation:(cpFloat)r
Declared In
SpaceManager.h
addRectToBody:width:height:rotation:offset:
add a rectangle shape to existing body, with offset
- (cpShape *)addRectToBody:(cpBody *)body width:(cpFloat)width height:(cpFloat)height rotation:(cpFloat)r offset:(CGPoint)offset
Declared In
SpaceManager.h
addRotaryLimitToBody:fromBody:min:max:
Specify a min and a max a body can rotate relative to another body
- (cpConstraint *)addRotaryLimitToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody min:(cpFloat)min max:(cpFloat)max
Declared In
SpaceManager.h
addRotaryLimitToBody:min:max:
Specify a min and a max a body can rotate
- (cpConstraint *)addRotaryLimitToBody:(cpBody *)toBody min:(cpFloat)min max:(cpFloat)max
Declared In
SpaceManager.h
addRotarySpringToBody:fromBody:restAngle:stiffness:damping:
Add a rotary spring between two bodies
- (cpConstraint *)addRotarySpringToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody restAngle:(cpFloat)restAngle stiffness:(cpFloat)stiff damping:(cpFloat)damp
Declared In
SpaceManager.h
addRotarySpringToBody:restAngle:stiffness:damping:
Add a rotary spring to a body
- (cpConstraint *)addRotarySpringToBody:(cpBody *)toBody restAngle:(cpFloat)restAngle stiffness:(cpFloat)stiff damping:(cpFloat)damp
Declared In
SpaceManager.h
addShape:
Manually add a shape to the space
- (void)addShape:(cpShape *)shape
Declared In
SpaceManager.h
addSlideToBody:fromBody:minLength:maxLength:
Add a sliding joint between two bodies
- (cpConstraint *)addSlideToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody minLength:(cpFloat)min maxLength:(cpFloat)max
Declared In
SpaceManager.h
addSlideToBody:fromBody:toBodyAnchor:fromBodyAnchor:minLength:
Add a sliding joint between two bodies, calculating max length
- (cpConstraint *)addSlideToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchr1 fromBodyAnchor:(cpVect)anchr2 minLength:(cpFloat)min
Declared In
SpaceManager.h
addSlideToBody:fromBody:toBodyAnchor:fromBodyAnchor:minLength:maxLength:
Add a sliding joint between two bodies
- (cpConstraint *)addSlideToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchr1 fromBodyAnchor:(cpVect)anchr2 minLength:(cpFloat)min maxLength:(cpFloat)max
Declared In
SpaceManager.h
addSpringToBody:fromBody:restLength:stiffness:damping:
Add a spring to two bodies at the body anchor points
- (cpConstraint *)addSpringToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody restLength:(cpFloat)rest stiffness:(cpFloat)stiff damping:(cpFloat)damp
Declared In
SpaceManager.h
addSpringToBody:fromBody:stiffness:
Add a spring to two bodies at the body anchor points
- (cpConstraint *)addSpringToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody stiffness:(cpFloat)stiff
Declared In
SpaceManager.h
addSpringToBody:fromBody:toBodyAnchor:fromBodyAnchor:restLength:stiffness:damping:
Add a spring to two bodies at the body anchor points
- (cpConstraint *)addSpringToBody:(cpBody *)toBody fromBody:(cpBody *)fromBody toBodyAnchor:(cpVect)anchr1 fromBodyAnchor:(cpVect)anchr2 restLength:(cpFloat)rest stiffness:(cpFloat)stiff damping:(cpFloat)damp
Declared In
SpaceManager.h
applyLinearExplosionAt:radius:maxForce:
Explosion, applied linear force to objects within radius
- (void)applyLinearExplosionAt:(cpVect)at radius:(cpFloat)radius maxForce:(cpFloat)maxForce
Declared In
SpaceManager.h
applyLinearExplosionAt:radius:maxForce:layers:group:
Explosion, applied linear force to objects within radius given a group and layer(s)
- (void)applyLinearExplosionAt:(cpVect)at radius:(cpFloat)radius maxForce:(cpFloat)maxForce layers:(cpLayers)layers group:(cpGroup)group
Declared In
SpaceManager.h
combineShapes:
Combine two shapes together by combining their bodies into one
- (void)combineShapes:(cpShape *)shape, ...
Declared In
SpaceManager.h
fragmentCircle:piecesNum:eachMass:
This will take a circle and split it into the number of pieces you specify,
- (NSArray *)fragmentCircle:(cpCircleShape *)circle piecesNum:(int)pieces eachMass:(float)mass
Return Value
An NSArray of NSValues with cpShape* as the value (the fragments) or nil if failed
Declared In
SpaceManager.h
fragmentRect:rowPiecesNum:colPiecesNum:eachMass:
This will take a rect and split it into the number of pieces (Rows x Cols) you specify,
- (NSArray *)fragmentRect:(cpPolyShape *)poly rowPiecesNum:(int)rows colPiecesNum:(int)cols eachMass:(float)mass
Return Value
An NSArray of NSValues with cpShape* as the value (the fragments) or nil if failed
Declared In
SpaceManager.h
fragmentSegment:piecesNum:eachMass:
This will take a segment and split it into the number of pieces you specify,
- (NSArray *)fragmentSegment:(cpSegmentShape *)segment piecesNum:(int)pieces eachMass:(float)mass
Return Value
An NSArray of NSValues with cpShape* as the value (the fragments) or nil if failed
Declared In
SpaceManager.h
fragmentShape:piecesNum:eachMass:
This will take a shape (any) and split it into the number of pieces you specify,
- (NSArray *)fragmentShape:(cpShape *)shape piecesNum:(int)pieces eachMass:(float)mass
Return Value
An NSArray of NSValues with cpShape* as the value (the fragments) or nil if failed
Declared In
SpaceManager.h
getConstraints
Will return an array of NSValues that point to the cpConstraints
- (NSArray *)getConstraints
Declared In
SpaceManager.h
getConstraintsOnBody:
Will return an array of NSValues that point to the cpConstraints on given body
- (NSArray *)getConstraintsOnBody:(cpBody *)body
Declared In
SpaceManager.h
getInfoFromRayCastSegment:end:
see getInfoFromRayCastSegment:end:layers:group:
- (cpSegmentQueryInfo)getInfoFromRayCastSegment:(cpVect)start end:(cpVect)end
Declared In
SpaceManager.h
getInfoFromRayCastSegment:end:layers:group:
Return the info on the first shape hit by the given raycast
- (cpSegmentQueryInfo)getInfoFromRayCastSegment:(cpVect)start end:(cpVect)end layers:(cpLayers)layers group:(cpGroup)group
Declared In
SpaceManager.h
getInfosFromRayCastSegment:end:
see getInfosFromRayCastSegment:end:layers:group:
- (NSArray *)getInfosFromRayCastSegment:(cpVect)start end:(cpVect)end
Declared In
SpaceManager.h
getInfosFromRayCastSegment:end:layers:group:
Return an array of NSValues with a pointer to a cpSegmentQueryInfo, this array will clean up the infos when released
- (NSArray *)getInfosFromRayCastSegment:(cpVect)start end:(cpVect)end layers:(cpLayers)layers group:(cpGroup)group
Declared In
SpaceManager.h
getShapeAt:
Retrieve the first shape found at this position
- (cpShape *)getShapeAt:(cpVect)pos
Declared In
SpaceManager.h
getShapeAt:layers:group:
Retrieve the first shape found at this position matching layers and group
- (cpShape *)getShapeAt:(cpVect)pos layers:(cpLayers)layers group:(cpLayers)group
Declared In
SpaceManager.h
getShapeFromRayCastSegment:end:
see getShapeFromRayCastSegment:end:layers:group:
- (cpShape *)getShapeFromRayCastSegment:(cpVect)start end:(cpVect)end
Declared In
SpaceManager.h
getShapeFromRayCastSegment:end:layers:group:
Return first shape hit by the given raycast
- (cpShape *)getShapeFromRayCastSegment:(cpVect)start end:(cpVect)end layers:(cpLayers)layers group:(cpGroup)group
Declared In
SpaceManager.h
getShapesAt:
getShapesAt:layers:group:
- (NSArray *)getShapesAt:(cpVect)pos
See Also
Declared In
SpaceManager.h
getShapesAt:layers:group:
Given a point, return an array of NSValues with a pointer to a cpShape
- (NSArray *)getShapesAt:(cpVect)pos layers:(cpLayers)layers group:(cpLayers)group
Declared In
SpaceManager.h
getShapesAt:radius:
getShapesAt:radius:layers:group:
- (NSArray *)getShapesAt:(cpVect)pos radius:(float)radius
See Also
Declared In
SpaceManager.h
getShapesAt:radius:layers:group:
Given a point and a radius, return an array of NSValues with a pointer to a cpShape
- (NSArray *)getShapesAt:(cpVect)pos radius:(float)radius layers:(cpLayers)layers group:(cpLayers)group
Declared In
SpaceManager.h
getShapesFromRayCastSegment:end:
see getShapesFromRayCastSegment:end:layers:group:
- (NSArray *)getShapesFromRayCastSegment:(cpVect)start end:(cpVect)end
Declared In
SpaceManager.h
getShapesFromRayCastSegment:end:layers:group:
Return an array of NSValues with a pointer to a cpShape that intersects the raycast
- (NSArray *)getShapesFromRayCastSegment:(cpVect)start end:(cpVect)end layers:(cpLayers)layers group:(cpGroup)group
Declared In
SpaceManager.h
getShapesOnBody:
Get shapes that are using this body
- (NSArray *)getShapesOnBody:(cpBody *)body
Declared In
SpaceManager.h
ignoreCollisionBetweenType:otherType:
Unique Collision: will ignore the effects a collsion between types
- (void)ignoreCollisionBetweenType:(unsigned int)type1 otherType:(unsigned int)type2
Declared In
SpaceManager.h
initWithSize:count:
Initialization method
- (id)initWithSize:(int)size count:(int)count
Parameters
- size
The average size of shapes in space
- count
The expected number of shapes in a space (larger is better)
Declared In
SpaceManager.h
isBodyShared:
Check is body belongs to more than one shape
- (BOOL)isBodyShared:(cpBody *)body
Declared In
SpaceManager.h
isPersistentContactOnShape:contactShape:
Queries the space as to whether these two shapes are in persistent contact
- (BOOL)isPersistentContactOnShape:(cpShape *)shape contactShape:(cpShape *)shape2
Declared In
SpaceManager.h
loadSpaceFromPath:delegate:
load a cpSerializer file from a file (path), delegate can be nil
- (BOOL)loadSpaceFromPath:(NSString *)path delegate:(NSObject<SpaceManagerSerializeDelegate> *)delegate
Declared In
SpaceManager.h
loadSpaceFromUserDocs:delegate:
load a cpSerializer file from a user docs file, delegate can be nil
- (BOOL)loadSpaceFromUserDocs:(NSString *)file delegate:(NSObject<SpaceManagerSerializeDelegate> *)delegate
Declared In
SpaceManager.h
loadedBodyForId:
after a load from a file, use this to retrieve a shape from it’s id in the file
- (cpBody *)loadedBodyForId:(UInt64)bodyId
Declared In
SpaceManager.h
loadedShapeForId:
after a load from a file, use this to retrieve a shape from it’s id in the file
- (cpShape *)loadedShapeForId:(UInt64)shapeId
Declared In
SpaceManager.h
morphShapeToActive:mass:
This will force a shape active and give it the given mass
- (cpShape *)morphShapeToActive:(cpShape *)shape mass:(cpFloat)mass
Declared In
SpaceManager.h
morphShapeToKinematic:
This will force a shape to be kinematic (body will not simulate)
- (cpShape *)morphShapeToKinematic:(cpShape *)shape
Declared In
SpaceManager.h
morphShapeToStatic:
This will force a shape into a static shape
- (cpShape *)morphShapeToStatic:(cpShape *)shape
Declared In
SpaceManager.h
offsetShape:offset:
Offset shape from body using (circle:center, segment:endpoints, poly:vertices)
- (void)offsetShape:(cpShape *)shape offset:(cpVect)offset
Declared In
SpaceManager.h
persistentContactInfoOnShape:
Queries the space as to whether this shape has a persistent contact, returns the first arbiter info
- (cpArbiter *)persistentContactInfoOnShape:(cpShape *)shape
Declared In
SpaceManager.h
persistentContactInfosOnShape:
Queries the space as to whether this shape has a persistent contact, returns the all arbiters
- (NSArray *)persistentContactInfosOnShape:(cpShape *)shape
Declared In
SpaceManager.h
persistentContactOnShape:
Queries the space as to whether this shape has ANY persistent contact, It will return the first shape it finds or NULL if nothing is found
- (cpShape *)persistentContactOnShape:(cpShape *)shape
Declared In
SpaceManager.h
rehashActiveShapes
Use if you need to call getShapes before you’ve actually started simulating
- (void)rehashActiveShapes
Declared In
SpaceManager.h
rehashShape:
Use to only rehash one shape
- (void)rehashShape:(cpShape *)shape
Declared In
SpaceManager.h
rehashStaticShapes
Use if you move static shapes during simulation
- (void)rehashStaticShapes
Declared In
SpaceManager.h
removeAndFreeBody:
Use when removing & freeing a body
- (void)removeAndFreeBody:(cpBody *)body
Declared In
SpaceManager.h
removeAndFreeConstraint:
This will remove and free the constraint
- (void)removeAndFreeConstraint:(cpConstraint *)constraint
Declared In
SpaceManager.h
removeAndFreeConstraintsOnBody:
This will calculate all constraints on a body and remove & free them
- (void)removeAndFreeConstraintsOnBody:(cpBody *)body
Declared In
SpaceManager.h
removeAndFreeShape:
Use when removing & freeing a shape AND it’s body if the body is not used by other shapes
- (void)removeAndFreeShape:(cpShape *)shape
Declared In
SpaceManager.h
removeBody:
Use when removing a body, will pass ownership to caller
- (void)removeBody:(cpBody *)body
Declared In
SpaceManager.h
removeCollisionCallbackBetweenType:otherType:
Unregister a collision callback between types
- (void)removeCollisionCallbackBetweenType:(unsigned int)type1 otherType:(unsigned int)type2
Declared In
SpaceManager.h
removeConstraint:
Use when removing constraints, ownership is given to caller
- (cpConstraint *)removeConstraint:(cpConstraint *)constraint
Declared In
SpaceManager.h
removeShape:
Use when removing a shape, will pass ownership to caller
- (cpShape *)removeShape:(cpShape *)shape
Declared In
SpaceManager.h
saveSpaceToPath:delegate:
save a cpSerializer file to a resource file (path), delegate can be nil
- (BOOL)saveSpaceToPath:(NSString *)path delegate:(NSObject<SpaceManagerSerializeDelegate> *)delegate
Declared In
SpaceManager.h