PDG engine v0.9.5
 All Classes Namespaces Functions Variables Groups Pages
Public Member Functions | List of all members
CpSpace Class Reference

container for simulating objects (Chipmunk Physics Only) More...

Public Member Functions

number getCollisionBias ()
 get the percentage of overlap between colliding bodies that is left unfixed after each step More...
 
number getCollisionPersistence ()
 get how many steps collision solutions are maintained to prevent jittering More...
 
number getCollisionSlop ()
 get allowed amount of overlap between shapes More...
 
number getIdleSpeedThreshold ()
 get speed threshold for a body to be considered idle More...
 
number getSleepTimeThreshold ()
 get time a group of bodies must remain idle in order to fall asleep More...
 
 reindexStatic ()
 Update the collision detection info for the all static shapes in the space. More...
 
CpSpace setCollisionBias (number inCollisionBias)
 set the percentage of overlap between colliding bodies that is left unfixed after each step More...
 
CpSpace setCollisionPersistence (number inCollisionPersistence)
 set how many steps collision solutions are maintained to prevent jittering More...
 
CpSpace setCollisionSlop (number inCollisionSlop)
 set allowed amount of overlap between shapes More...
 
CpSpace setIdleSpeedThreshold (number inIdleSpeedThreshold)
 set speed threshold for a body to be considered idle More...
 
CpSpace setSleepTimeThreshold (number inSleepTimeThreshold)
 set time a group of bodies must remain idle in order to fall asleep More...
 
 step (number dt)
 step forward in time More...
 
 useSpatialHash (number dim, int count)
 use the spacial hash algorithm for collision detection More...
 

Detailed Description

container for simulating objects (Chipmunk Physics Only)

Warning
API Stability: 1 - Experimental. This API was introduced recently and gotten little or no real use. It may change or be removed in future versions. It may not be completely implemented and may be missing important pieces of functionality. Please try it out and provide feedback.
See Also
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpSpace

Member Function Documentation

getCollisionBias ( )

get the percentage of overlap between colliding bodies that is left unfixed after each step

getCollisionPersistence ( )

get how many steps collision solutions are maintained to prevent jittering

getCollisionSlop ( )

get allowed amount of overlap between shapes

getIdleSpeedThreshold ( )

get speed threshold for a body to be considered idle

From Chipmunk cpSpace comments:

The default value of 0 means to let the space guess a good threshold based on gravity.
getSleepTimeThreshold ( )

get time a group of bodies must remain idle in order to fall asleep

From Chipmunk cpSpace comments:

Enabling sleeping also implicitly enables the the contact graph. The default value of INFINITY disables the sleeping algorithm.
reindexStatic ( )

Update the collision detection info for the all static shapes in the space.

setCollisionBias ( number  inCollisionBias)

set the percentage of overlap between colliding bodies that is left unfixed after each step

From cpSpace comments:

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
setCollisionPersistence ( number  inCollisionPersistence)

set how many steps collision solutions are maintained to prevent jittering

From the cpSpace comments:

Defaults to 3. There is probably never a reason to change this value.
setCollisionSlop ( number  inCollisionSlop)

set allowed amount of overlap between shapes

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.

setIdleSpeedThreshold ( number  inIdleSpeedThreshold)

set speed threshold for a body to be considered idle

From Chipmunk cpSpace comments:

The default value of 0 means to let the space guess a good threshold based on gravity.
setSleepTimeThreshold ( number  inSleepTimeThreshold)

set time a group of bodies must remain idle in order to fall asleep

From Chipmunk cpSpace comments:

Enabling sleeping also implicitly enables the the contact graph. The default value of INFINITY disables the sleeping algorithm.
step ( number  dt)

step forward in time

Parameters
dtthe number of seconds to shift
Note
calling this will correctly update the physics based objects, but will not not update animations of other kinds for sprites.
useSpatialHash ( number  dim,
int  count 
)

use the spacial hash algorithm for collision detection

This can be more efficient when you have a lot of objects that are the same size. See the detailed documentation in Chipmunk docs for more info.

See Also
http://files.slembcke.net/chipmunk/release/ChipmunkLatest-Docs/#cpSpace-SpatialHash

User Comments