Class

SKRegion

A definition of an arbitrary area.

Declaration

class SKRegion : NSObject

Overview

An SKRegion object defines a mathematical shape and is typically used to determine whether a particular point lies inside this area. For example, regions are used to define the area that a physics field can affect. Regions are defined using paths and mathematical shapes and can also be combined using constructive solid geometry.

Topics

Creating and Initializing Region Objects

class func infinite() -> Self

Returns a region that defines a region that includes all points.

init(size: CGSize)

Initializes a new region with a rectangular area.

init(radius: Float)

Initializes a new region with a circular area.

init(path: CGPath)

Initializes a new region using a Core Graphics path.

func inverse() -> Self

Returns a new region that is the mathematical inverse of an existing region.

func byDifference(from: SKRegion) -> Self

Returns a new region created by subtracting the contents of another region from this region.

func byIntersection(with: SKRegion) -> Self

Returns a new region created by intersecting the contents of this region with another region.

func byUnion(with: SKRegion) -> Self

Returns a new region created by combining the contents of this region with another region.

Interacting with a Region

var path: CGPath?

Returns a Core Graphics path that defines the region.

func contains(CGPoint) -> Bool

Returns a Boolean value that indicates whether a particular point is contained in the region.

Relationships

Inherits From

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.

class SKPhysicsContact

A description of the contact between two physics bodies.

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.