---
title: "init(type:shape:)"
framework: scenekit
role: symbol
role_heading: Initializer
path: "scenekit/scnphysicsbody/init(type:shape:)"
---

# init(type:shape:)

Creates a physics body with the specified type and shape.

## Declaration

```swift
convenience init(type: SCNPhysicsBodyType, shape: SCNPhysicsShape?)
```

## Parameters

- `type`: A constant that determines how a body responds to forces and collisions. See doc://com.apple.scenekit/documentation/SceneKit/SCNPhysicsBodyType.
- `shape`: A physics shape defining the volume of the body for collision detection purposes.

## Return Value

Return Value A new physics body object.

## Discussion

Discussion For the body to participate in collision detection or respond to forces, you must attach it to the physicsBody property of an SCNNode object in a scene. If you pass nil for the shape parameter, SceneKit automatically creates a physics shape for the body when you attach it to a node, based on that node’s geometry property. To create a physics shape that’s based on the geometries of a node and its hierarchy of children, or to control the level of detail in a physics shape, create the physics shape manually using an SCNPhysicsShape class method. note: For nodes containing custom geometry, the physics shape SceneKit automatically creates is a rough approximation of the geometry. This approximation, or convex hull, provides a compromise between accuracy and performance in collision detection. For the best collision detection performance, create an SCNPhysicsShape instance based on a basic geometry class (SCNBox, SCNSphere, SCNPyramid, SCNCone, SCNCylinder, or SCNCapsule).

## See Also

### Related Documentation

- [type](scenekit/scnphysicsbody/type.md)
- [physicsShape](scenekit/scnphysicsbody/physicsshape.md)

### Creating Physics Bodies

- [static()](scenekit/scnphysicsbody/static().md)
- [dynamic()](scenekit/scnphysicsbody/dynamic().md)
- [kinematic()](scenekit/scnphysicsbody/kinematic().md)
