|
Chipmunk2D Pro API Reference
6.1.5
|
Classes | |
| struct | cpSpace |
| Basic Unit of Simulation in Chipmunk. More... | |
Typedefs | |
| typedef void(* | cpPostStepFunc )(cpSpace *space, void *key, void *data) |
| Post Step callback function type. | |
| typedef void(* | cpSpacePointQueryFunc )(cpShape *shape, void *data) |
| Point query callback function type. | |
| typedef void(* | cpSpaceNearestPointQueryFunc )(cpShape *shape, cpFloat distance, cpVect point, void *data) |
| Nearest point query callback function type. | |
| typedef void(* | cpSpaceSegmentQueryFunc )(cpShape *shape, cpFloat t, cpVect n, void *data) |
| Segment query callback function type. | |
| typedef void(* | cpSpaceBBQueryFunc )(cpShape *shape, void *data) |
| Rectangle Query callback function type. | |
| typedef void(* | cpSpaceShapeQueryFunc )(cpShape *shape, cpContactPointSet *points, void *data) |
| Shape query callback function type. | |
| typedef void(* | cpSpaceBodyIteratorFunc )(cpBody *body, void *data) |
| Space/body iterator callback function type. | |
| typedef void(* | cpSpaceShapeIteratorFunc )(cpShape *shape, void *data) |
| Space/body iterator callback function type. | |
| typedef void(* | cpSpaceConstraintIteratorFunc )(cpConstraint *constraint, void *data) |
| Space/constraint iterator callback function type. | |
Functions | |
| cpSpace * | cpSpaceAlloc (void) |
| Allocate a cpSpace. | |
| cpSpace * | cpSpaceInit (cpSpace *space) |
| Initialize a cpSpace. | |
| cpSpace * | cpSpaceNew (void) |
| Allocate and initialize a cpSpace. | |
| void | cpSpaceDestroy (cpSpace *space) |
| Destroy a cpSpace. | |
| void | cpSpaceFree (cpSpace *space) |
| Destroy and free a cpSpace. | |
| static cpBool | cpSpaceIsLocked (cpSpace *space) |
| returns true from inside a callback and objects cannot be added/removed. | |
| void | cpSpaceSetDefaultCollisionHandler (cpSpace *space, cpCollisionBeginFunc begin, cpCollisionPreSolveFunc preSolve, cpCollisionPostSolveFunc postSolve, cpCollisionSeparateFunc separate, void *data) |
| Set a default collision handler for this space. More... | |
| void | cpSpaceAddCollisionHandler (cpSpace *space, cpCollisionType a, cpCollisionType b, cpCollisionBeginFunc begin, cpCollisionPreSolveFunc preSolve, cpCollisionPostSolveFunc postSolve, cpCollisionSeparateFunc separate, void *data) |
| Set a collision handler to be used whenever the two shapes with the given collision types collide. More... | |
| void | cpSpaceRemoveCollisionHandler (cpSpace *space, cpCollisionType a, cpCollisionType b) |
| Unset a collision handler. | |
| cpShape * | cpSpaceAddShape (cpSpace *space, cpShape *shape) |
| Add a collision shape to the simulation. More... | |
| cpShape * | cpSpaceAddStaticShape (cpSpace *space, cpShape *shape) |
| Explicity add a shape as a static shape to the simulation. | |
| cpBody * | cpSpaceAddBody (cpSpace *space, cpBody *body) |
| Add a rigid body to the simulation. | |
| cpConstraint * | cpSpaceAddConstraint (cpSpace *space, cpConstraint *constraint) |
| Add a constraint to the simulation. | |
| void | cpSpaceRemoveShape (cpSpace *space, cpShape *shape) |
| Remove a collision shape from the simulation. | |
| void | cpSpaceRemoveStaticShape (cpSpace *space, cpShape *shape) |
| Remove a collision shape added using cpSpaceAddStaticShape() from the simulation. | |
| void | cpSpaceRemoveBody (cpSpace *space, cpBody *body) |
| Remove a rigid body from the simulation. | |
| void | cpSpaceRemoveConstraint (cpSpace *space, cpConstraint *constraint) |
| Remove a constraint from the simulation. | |
| cpBool | cpSpaceContainsShape (cpSpace *space, cpShape *shape) |
| Test if a collision shape has been added to the space. | |
| cpBool | cpSpaceContainsBody (cpSpace *space, cpBody *body) |
| Test if a rigid body has been added to the space. | |
| cpBool | cpSpaceContainsConstraint (cpSpace *space, cpConstraint *constraint) |
| Test if a constraint has been added to the space. | |
| void | cpSpaceConvertBodyToStatic (cpSpace *space, cpBody *body) |
| Convert a dynamic rogue body to a static one. More... | |
| void | cpSpaceConvertBodyToDynamic (cpSpace *space, cpBody *body, cpFloat mass, cpFloat moment) |
| Convert a body to a dynamic rogue body. More... | |
| cpBool | cpSpaceAddPostStepCallback (cpSpace *space, cpPostStepFunc func, void *key, void *data) |
| Schedule a post-step callback to be called when cpSpaceStep() finishes. More... | |
| void | cpSpacePointQuery (cpSpace *space, cpVect point, cpLayers layers, cpGroup group, cpSpacePointQueryFunc func, void *data) |
Query the space at a point and call func for each shape found. | |
| cpShape * | cpSpacePointQueryFirst (cpSpace *space, cpVect point, cpLayers layers, cpGroup group) |
| Query the space at a point and return the first shape found. Returns NULL if no shapes were found. | |
| void | cpSpaceNearestPointQuery (cpSpace *space, cpVect point, cpFloat maxDistance, cpLayers layers, cpGroup group, cpSpaceNearestPointQueryFunc func, void *data) |
Query the space at a point and call func for each shape found. | |
| cpShape * | cpSpaceNearestPointQueryNearest (cpSpace *space, cpVect point, cpFloat maxDistance, cpLayers layers, cpGroup group, cpNearestPointQueryInfo *out) |
| Query the space at a point and return the nearest shape found. Returns NULL if no shapes were found. | |
| void | cpSpaceSegmentQuery (cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSpaceSegmentQueryFunc func, void *data) |
Perform a directed line segment query (like a raycast) against the space calling func for each shape intersected. | |
| cpShape * | cpSpaceSegmentQueryFirst (cpSpace *space, cpVect start, cpVect end, cpLayers layers, cpGroup group, cpSegmentQueryInfo *out) |
| Perform a directed line segment query (like a raycast) against the space and return the first shape hit. Returns NULL if no shapes were hit. | |
| void | cpSpaceBBQuery (cpSpace *space, cpBB bb, cpLayers layers, cpGroup group, cpSpaceBBQueryFunc func, void *data) |
Perform a fast rectangle query on the space calling func for each shape found. More... | |
| cpBool | cpSpaceShapeQuery (cpSpace *space, cpShape *shape, cpSpaceShapeQueryFunc func, void *data) |
Query a space for any shapes overlapping the given shape and call func for each shape found. | |
| void | cpSpaceActivateShapesTouchingShape (cpSpace *space, cpShape *shape) |
| Call cpBodyActivate() for any shape that is overlaps the given shape. | |
| void | cpSpaceEachBody (cpSpace *space, cpSpaceBodyIteratorFunc func, void *data) |
Call func for each body in the space. | |
| void | cpSpaceEachShape (cpSpace *space, cpSpaceShapeIteratorFunc func, void *data) |
Call func for each shape in the space. | |
| void | cpSpaceEachConstraint (cpSpace *space, cpSpaceConstraintIteratorFunc func, void *data) |
Call func for each shape in the space. | |
| void | cpSpaceReindexStatic (cpSpace *space) |
| Update the collision detection info for the static shapes in the space. | |
| void | cpSpaceReindexShape (cpSpace *space, cpShape *shape) |
| Update the collision detection data for a specific shape in the space. | |
| void | cpSpaceReindexShapesForBody (cpSpace *space, cpBody *body) |
| Update the collision detection data for all shapes attached to a body. | |
| void | cpSpaceUseSpatialHash (cpSpace *space, cpFloat dim, int count) |
| Switch the space to use a spatial has as it's spatial index. | |
| void | cpSpaceStep (cpSpace *space, cpFloat dt) |
Step the space forward in time by dt. | |
| void cpSpaceAddCollisionHandler | ( | cpSpace * | space, |
| cpCollisionType | a, | ||
| cpCollisionType | b, | ||
| cpCollisionBeginFunc | begin, | ||
| cpCollisionPreSolveFunc | preSolve, | ||
| cpCollisionPostSolveFunc | postSolve, | ||
| cpCollisionSeparateFunc | separate, | ||
| void * | data | ||
| ) |
Set a collision handler to be used whenever the two shapes with the given collision types collide.
You can pass NULL for any function you don't want to implement.
| cpBool cpSpaceAddPostStepCallback | ( | cpSpace * | space, |
| cpPostStepFunc | func, | ||
| void * | key, | ||
| void * | data | ||
| ) |
Schedule a post-step callback to be called when cpSpaceStep() finishes.
You can only register one callback per unique value for key. Returns true only if key has never been scheduled before. It's possible to pass NULL for func if you only want to mark key as being used.
Add a collision shape to the simulation.
If the shape is attached to a static body, it will be added as a static shape.
| void cpSpaceBBQuery | ( | cpSpace * | space, |
| cpBB | bb, | ||
| cpLayers | layers, | ||
| cpGroup | group, | ||
| cpSpaceBBQueryFunc | func, | ||
| void * | data | ||
| ) |
Perform a fast rectangle query on the space calling func for each shape found.
Only the shape's bounding boxes are checked for overlap, not their full shape.
Convert a body to a dynamic rogue body.
If you want the body to be active after the transition, you must add it to the space also.
Convert a dynamic rogue body to a static one.
If the body is active, you must remove it from the space first.
| void cpSpaceSetDefaultCollisionHandler | ( | cpSpace * | space, |
| cpCollisionBeginFunc | begin, | ||
| cpCollisionPreSolveFunc | preSolve, | ||
| cpCollisionPostSolveFunc | postSolve, | ||
| cpCollisionSeparateFunc | separate, | ||
| void * | data | ||
| ) |
Set a default collision handler for this space.
The default collision handler is invoked for each colliding pair of shapes that isn't explicitly handled by a specific collision handler. You can pass NULL for any function you don't want to implement.
1.8.3.1