Class

SKPhysicsContact

A description of the contact between two physics bodies.

Declaration

class SKPhysicsContact : NSObject

Overview

An SKPhysicsContact object is created automatically by SpriteKit to describe 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.

Topics

Inspecting the Contact Properties

var bodyA: SKPhysicsBody

The first body in the contact.

var bodyB: SKPhysicsBody

The second body in the contact.

var contactPoint: CGPoint

The contact point between the two physics bodies, in scene coordinates.

var collisionImpulse: CGFloat

The impulse that specifies how hard these two bodies struck each other in Newton-seconds.

var contactNormal: CGVector

The normal vector specifying the direction of the collision.

Relationships

Inherits From

Conforms To

See Also

Simulating Physics

class SKPhysicsWorld

An object which encapsulates a scene's physics simulation.

class SKPhysicsBody

An object which adds physics simulation to a node.

protocol SKPhysicsContactDelegate

Methods your app can implement to respond when physics bodies come into contact.

class SKPhysicsJoint

The abstract superclass for objects that connect physics bodies.

class SKPhysicsJointFixed

A joint that fixes two physics bodies together.

class SKPhysicsJointLimit

A joint that imposes a maximum distance between two physics bodies, as if they were connected by a rope.

class SKPhysicsJointPin

A joint that pins together two physics bodies, allowing independent rotation.

class SKPhysicsJointSliding

A joint that allows two physics bodies to slide along an axis.

class SKPhysicsJointSpring

A joint that simulates a spring connecting two physics bodies.

class SKFieldNode

A node that applies physics effects to a portion of the scene.

class SKRegion

A definition of an arbitrary area.