Chipmunk  6.0.3
Chipmunk API Reference for Kobold2D developers
cpSpace Struct Reference

Basic Unit of Simulation in Chipmunk. More...

#include <cpSpace.h>

Collaboration diagram for cpSpace:

Public Member Functions

 CP_PRIVATE (cpTimestamp stamp)
 CP_PRIVATE (cpFloat curr_dt)
 CP_PRIVATE (cpArray *bodies)
 CP_PRIVATE (cpArray *rousedBodies)
 CP_PRIVATE (cpArray *sleepingComponents)
 CP_PRIVATE (cpSpatialIndex *staticShapes)
 CP_PRIVATE (cpSpatialIndex *activeShapes)
 CP_PRIVATE (cpArray *arbiters)
 CP_PRIVATE (cpContactBufferHeader *contactBuffersHead)
 CP_PRIVATE (cpHashSet *cachedArbiters)
 CP_PRIVATE (cpArray *pooledArbiters)
 CP_PRIVATE (cpArray *constraints)
 CP_PRIVATE (cpArray *allocatedBuffers)
 CP_PRIVATE (int locked)
 CP_PRIVATE (cpHashSet *collisionHandlers)
 CP_PRIVATE (cpCollisionHandler defaultHandler)
 CP_PRIVATE (cpHashSet *postStepCallbacks)
 CP_PRIVATE (cpSpaceArbiterApplyImpulseFunc arbiterApplyImpulse)
 CP_PRIVATE (cpBody _staticBody)

Data Fields

int iterations
 Number of iterations to use in the impulse solver to solve contacts.
cpVect gravity
 Gravity to pass to rigid bodies when integrating velocity.
cpFloat damping
cpFloat idleSpeedThreshold
cpFloat sleepTimeThreshold
cpFloat collisionSlop
cpFloat collisionBias
cpTimestamp collisionPersistence
cpBool enableContactGraph
cpDataPointer data
cpBodystaticBody

Detailed Description

Basic Unit of Simulation in Chipmunk.


Member Function Documentation

cpSpace::CP_PRIVATE ( cpTimestamp  stamp)
cpSpace::CP_PRIVATE ( cpFloat  curr_dt)
cpSpace::CP_PRIVATE ( cpArray bodies)
cpSpace::CP_PRIVATE ( cpArray rousedBodies)
cpSpace::CP_PRIVATE ( cpArray sleepingComponents)
cpSpace::CP_PRIVATE ( cpSpatialIndex staticShapes)
cpSpace::CP_PRIVATE ( cpSpatialIndex activeShapes)
cpSpace::CP_PRIVATE ( cpArray arbiters)
cpSpace::CP_PRIVATE ( cpContactBufferHeader contactBuffersHead)
cpSpace::CP_PRIVATE ( cpHashSet cachedArbiters)
cpSpace::CP_PRIVATE ( cpArray pooledArbiters)
cpSpace::CP_PRIVATE ( cpArray constraints)
cpSpace::CP_PRIVATE ( cpArray allocatedBuffers)
cpSpace::CP_PRIVATE ( int  locked)
cpSpace::CP_PRIVATE ( cpHashSet collisionHandlers)
cpSpace::CP_PRIVATE ( cpCollisionHandler  defaultHandler)
cpSpace::CP_PRIVATE ( cpHashSet postStepCallbacks)
cpSpace::CP_PRIVATE ( cpSpaceArbiterApplyImpulseFunc  arbiterApplyImpulse)
cpSpace::CP_PRIVATE ( cpBody  _staticBody)

Field Documentation

Determines how fast overlapping shapes are pushed apart. Expressed as a fraction of the error remaining after each second. Defaults to pow(1.0 - 0.1, 60.0) meaning that Chipmunk fixes 10% of overlap each frame at 60Hz.

Number of frames that contact information should persist. Defaults to 3. There is probably never a reason to change this value.

Amount of encouraged penetration between colliding shapes. Used to reduce oscillating contacts and keep the collision cache warm. Defaults to 0.1. If you have poor simulation quality, increase this number as much as possible without allowing visible amounts of overlap.

Damping rate expressed as the fraction of velocity bodies retain each second. A value of 0.9 would mean that each body's velocity will drop 10% per second. The default value is 1.0, meaning no damping is applied.

Note:
This damping value is different than those of cpDampedSpring and cpDampedRotarySpring.

User definable data pointer. Generally this points to your game's controller or game state class so you can access it when given a cpSpace reference in a callback.

Rebuild the contact graph during each step. Must be enabled to use the cpBodyEachArbiter() function. Disabled by default for a small performance boost. Enabled implicitly when the sleeping feature is enabled.

Gravity to pass to rigid bodies when integrating velocity.

Speed threshold for a body to be considered idle. The default value of 0 means to let the space guess a good threshold based on gravity.

Number of iterations to use in the impulse solver to solve contacts.

Time a group of bodies must remain idle in order to fall asleep. Enabling sleeping also implicitly enables the the contact graph. The default value of INFINITY disables the sleeping algorithm.

The designated static body for this space. You can modify this body, or replace it with your own static body. By default it points to a statically allocated cpBody in the cpSpace struct.


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