All functions

as.list(<cpTransform>)

Unpack cpVect struct to a list

as.list(<cpVect>)

Unpack cpVect struct to a list

cpAreaForCircle()

Calculate area of a hollow circle. @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

cpAreaForPoly()

Calculate the signed area of a polygon. A Clockwise winding gives positive area. This is probably backwards from what you expect, but matches Chipmunk's the winding for poly shapes.

cpAreaForSegment()

Calculate the area of a fattened (capsule shaped) line segment.

cpBodyGetAngle()

Get the angle of the body.

cpBodyGetCenterOfGravity()

Get the offset of the center of gravity in body local coordinates.

cpBodyGetForce()

Get the force applied to the body for the next time step.

cpBodyGetPosition()

Set the position of a body.

cpBodyGetRotation()

Get the rotation vector of the body. (The x basis vector of it's transform.)

cpBodyGetVelocity()

Get the velocity of the body.

cpBodyNew()

Allocate and initialize a cpBody.

cpBodySetAngle()

Set the angle of a body.

cpBodySetAngularVelocity()

Set the angular velocity of the body.

cpBodySetPosition()

Set the position of the body.

cpBodySetTorque()

Set the torque applied to the body for the next time step.

cpBodySetVelocity()

Set the velocity of the body.

cpBoxShapeNew()

Allocate and initialize a box shaped polygon shape.

cpCentroidForPoly()

Calculate the natural centroid of a polygon.

cpCircleShapeNew()

Allocate and initialize a circle shape.

cpConstraintSetErrorBias()

Set rate at which joint error is corrected. Defaults to pow(1.0 - 0.1, 60.0) meaning that it will correct 10% of the error every 1/60th of a second.

cpConstraintSetMaxBias()

Set the maximum rate at which joint error is corrected. (defaults to INFINITY)

cpConstraintSetMaxForce()

Set the maximum force that this constraint is allowed to use. (defaults to INFINITY)

cpDampedSpringNew()

Allocate and initialize a damped spring.

cpDampedSpringSetDamping()

Set the damping of the spring.

cpDampedSpringSetRestLength()

Set the rest length of the spring.

cpDampedSpringSetStiffness()

Set the stiffness of the spring in force/distance.

cpMomentForBox()

Calculate the moment of inertia for a solid box.

cpMomentForCircle()

Calculate the moment of inertia for a circle. @c r1 and @c r2 are the inner and outer diameters. A solid circle has an inner diameter of 0.

cpMomentForPoly()

Calculate the moment of inertia for a solid polygon shape assuming it's center of gravity is at it's centroid. The offset is added to each vertex.

cpMomentForSegment()

Calculate the moment of inertia for a line segment. Beveling radius is not supported.

cpPolyShapeNew()

Allocate and initialize a polygon shape with rounded corners. A convex hull will be created from the vertexes.

cpSegmentShapeNew()

Allocate and initialize a segment shape.

cpShapeGetArea()

Get the calculated area of this shape.

cpShapeGetCenterOfGravity()

Get the centroid of this shape.

cpShapeGetMoment()

Get the calculated moment of inertia for this shape.

cpShapeSetDensity()

Set the density of this shape to have Chipmunk calculate mass properties for you.

cpShapeSetElasticity()

Set the elasticity of this shape.

cpShapeSetFriction()

Set the friction of this shape.

cpShapeSetMass()

Set the mass of this shape to have Chipmunk calculate mass properties for you.

cpShapeSetSensor()

Set if the shape is a sensor or not.

cpSpaceAddBody()

Add a rigid body to the simulation.

cpSpaceAddConstraint()

Add a constraint to the simulation.

cpSpaceAddShape()

Add a collision shape to the simulation. If the shape is attached to a static body, it will be added as a static shape.

cpSpaceContainsBody()

Test if a rigid body has been added to the space.

cpSpaceContainsConstraint()

Test if a constraint has been added to the space.

cpSpaceContainsShape()

Test if a collision shape has been added to the space.

cpSpaceGetCurrentTimeStep()

Returns the current (or most recent) time step used with the given space. Useful from callbacks if your time step is not a compile-time global.

cpSpaceGetStaticBody()

The Space provided static body for a given cpSpace. This is merely provided for convenience and you are not required to use it.

cpSpaceNew()

Allocate and initialize a cpSpace.

cpSpaceReindexShape()

Update the collision detection data for a specific shape in the space.

cpSpaceReindexShapesForBody()

Update the collision detection data for all shapes attached to a body.

cpSpaceReindexStatic()

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

cpSpaceRemoveBody()

Remove a rigid body from the simulation.

cpSpaceRemoveConstraint()

Remove a constraint from the simulation.

cpSpaceRemoveShape()

Remove a collision shape from the simulation.

cpSpaceSetCollisionBias()

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.

cpSpaceSetCollisionSlop()

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.

cpSpaceSetDamping()

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.

cpSpaceSetGravity()

Gravity to pass to rigid bodies when integrating velocity.

cpSpaceSetIdleSpeedThreshold()

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.

cpSpaceSetIterations()

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

cpSpaceSetSleepTimeThreshold()

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.

cpSpaceStep()

Step the space forward in time by @c dt.

cpTransformIdentity()

Create an identity transform

cpTransformMult()

Multiply two transformation matrices.

cpTransformNew()

Construct a new transform matrix. (a, b) is the x basis vector. (c, d) is the y basis vector. (tx, ty) is the translation.

cpTransformRigid()

Create a rigid transformation matrix. (transation + rotation)

cpTransformRotate()

Create a rotation matrix.

cpTransformScale()

Create a scale matrix.

cpTransformTranslate()

Create a transation matrix.

cpVect() cpv()

Create a pointer to a cpVect struct