Type Method

bodyWithEdgeLoopFromRect:

Creates an edge loop from a rectangle.

Declaration

+ (SKPhysicsBody *)bodyWithEdgeLoopFromRect:(CGRect)rect;

Parameters

rect

The rectangle that defines the edges. The rectangle is specified relative to the owning node’s origin.

Return Value

A new edge-based physics body.

Discussion

An edge has no volume or mass and is always treated as if the dynamic property is equal to NO. Edges may only collide with volume-based physics bodies.

See Also

Creating an Edge-Based Physics Body

Creating an Edge Loop Around a Scene

Border your scene with an obstacle that physics bodies cannot penetrate.

bodyWithEdgeFromPoint:toPoint:

Creates an edge between two points.

bodyWithEdgeLoopFromPath:

Creates an edge loop from a path.

bodyWithEdgeChainFromPath:

Creates an edge chain from a path.