SKPhysicsContact Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/SpriteKit.framework
Availability
Available in iOS 7.0 and later.
Companion guide
Declared in
SKPhysicsContact.h

Overview

An SKPhysicsContact object is created automatically by Scene Kit to describes a contact between two physical bodies in a physics world.

To receive contact messages, read the physicsWorld property of an SKScene object you are interested in, and assign its contactDelegate property to point to an object that implements the SKPhysicsContactDelegate protocol. Then, for each physics body in your scene, set the categoryBitMask and contactTestBitMask properties to define which interactions should generate contact messages.

Tasks

Inspecting the Contact Properties

Properties

bodyA

The first body in the contact. (read-only)

@property(readonly, nonatomic) SKPhysicsBody *bodyA
Availability
  • Available in iOS 7.0 and later.
Declared In
SKPhysicsContact.h

bodyB

The second body in the contact. (read-only)

@property(readonly, nonatomic) SKPhysicsBody *bodyB
Availability
  • Available in iOS 7.0 and later.
Declared In
SKPhysicsContact.h

collisionImpulse

The impulse that specifies how hard these two bodies struck each other in newton-seconds. (read-only)

@property(readonly, nonatomic) CGFloat collisionImpulse
Availability
  • Available in iOS 7.0 and later.
Declared In
SKPhysicsContact.h

contactPoint

The contact point between the two physics bodies, in scene coordinates. (read-only)

@property(readonly, nonatomic) CGPoint contactPoint
Availability
  • Available in iOS 7.0 and later.
Declared In
SKPhysicsContact.h