Inherits from NSObject
Declared in CCPhysicsNode.h

Overview

Contains information about two colliding physics objects. See CCPhysicsCollisionDelegate for more information.

Notes

  • There is only one CCPhysicsCollisionPair object per CCPhysicsNode and it’s reused so don’t store a reference to it.
  • You must copy any information you use from this struct if you want to use it later.

Properties

contacts

The contact information from the two colliding bodies.

@property (nonatomic, readonly) CCContactSet contacts

Declared In

CCPhysicsNode.h

friction

The friction coefficient for this pair of colliding shapes. The default value is pair.bodyA.friction*pair.bodyB.friction. Can be overriden in a CCCollisionPairDelegate pre-solve method to change the collision.

@property (nonatomic, assign) CGFloat friction

Declared In

CCPhysicsNode.h

restitution

The restitution coefficient for this pair of colliding shapes. The default value is “pair.bodyA.elasticity*pair.bodyB.elasticity”. Can be overriden in a CCCollisionPairDelegate pre-solve method to change the collision.

@property (nonatomic, assign) CGFloat restitution

Declared In

CCPhysicsNode.h

surfaceVelocity

The relative surface velocities of the two colliding shapes. See CCPhysicsBody.surfaceVelocity for more information. The default value is the surface velocity of the first body subtracted from the second, then clamped to the collision tangent. Can be overriden in a CCCollisionPairDelegate pre-solve method to change the collision.

@property (nonatomic, assign) CGPoint surfaceVelocity

Declared In

CCPhysicsNode.h

totalImpulse

The total impulse applied by this collision to the colliding shapes.

@property (nonatomic, readonly) CGPoint totalImpulse

Declared In

CCPhysicsNode.h

totalKineticEnergy

The amount of kinetic energy dissipated by the last collision of the two shapes. This is roughly equivalent to the idea of damage.

@property (nonatomic, readonly) CGFloat totalKineticEnergy

Discussion

Note: By definition, fully elastic collisions do not lose any energy or cause any permanent damage.

Declared In

CCPhysicsNode.h

userData

A persistent object reference associated with these two colliding objects. If you want to store some information about a collision from time step to time step, store it here. @todo Possible to add a default to release it automatically?

@property (nonatomic, assign) id userData

Declared In

CCPhysicsNode.h

Instance Methods

ignore

Ignore the collision between these two shapes bodies until they stop colliding. It’s idomatic to write “return [pair ignore];” if using this method from a CCCollisionPairDelegate pre-solve method.

- (BOOL)ignore

Return Value

FALSE

Declared In

CCPhysicsNode.h

shapeA:shapeB:

Retrive the specific physics shapes that were involved in the collision.

- (void)shapeA:(__autoreleasing CCPhysicsShape **)shapeA shapeB:(__autoreleasing CCPhysicsShape **)shapeB

Parameters

shapeA

Shape A.

shapeB

Shape B.

Declared In

CCPhysicsNode.h