Chipmunk2D Pro API Reference  6.2.1
 All Classes Functions Variables Typedefs Properties Groups Pages
Public Attributes | List of all members
cpSpace Struct Reference

Basic Unit of Simulation in Chipmunk. More...

#include <cpSpace.h>

Public Attributes

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
 Damping rate expressed as the fraction of velocity bodies retain each second. More...
 
cpFloat idleSpeedThreshold
 Speed threshold for a body to be considered idle. More...
 
cpFloat sleepTimeThreshold
 Time a group of bodies must remain idle in order to fall asleep. More...
 
cpFloat collisionSlop
 Amount of encouraged penetration between colliding shapes. More...
 
cpFloat collisionBias
 Determines how fast overlapping shapes are pushed apart. More...
 
cpTimestamp collisionPersistence
 Number of frames that contact information should persist. More...
 
cpBool enableContactGraph
 Rebuild the contact graph during each step. More...
 
cpDataPointer data
 User definable data pointer. More...
 
cpBodystaticBody
 The designated static body for this space. More...
 

Detailed Description

Basic Unit of Simulation in Chipmunk.

Member Data Documentation

cpFloat cpSpace::collisionBias

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.

cpTimestamp cpSpace::collisionPersistence

Number of frames that contact information should persist.

Defaults to 3. There is probably never a reason to change this value.

cpFloat cpSpace::collisionSlop

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.

cpFloat cpSpace::damping

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.
cpDataPointer cpSpace::data

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.

cpBool cpSpace::enableContactGraph

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.

cpFloat cpSpace::idleSpeedThreshold

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.

cpFloat cpSpace::sleepTimeThreshold

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.

cpBody* cpSpace::staticBody

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: