---
title: "addBehavior(_:)"
framework: scenekit
role: symbol
role_heading: Instance Method
path: "scenekit/scnphysicsworld/addbehavior(_:)"
---

# addBehavior(_:)

Adds a behavior to the physics world.

## Declaration

```swift
func addBehavior(_ behavior: SCNPhysicsBehavior)
```

## Parameters

- `behavior`: The behavior to be added.

## Discussion

Discussion Physics behaviors constrain or modify the effects of the physics simulation on sets of physics bodies. For example, the SCNPhysicsHingeJoint behavior causes two bodies to move as if connected by a hinge that pivots around a specific axis, and the SCNPhysicsVehicle behavior causes a body to roll like a car or other wheeled vehicle. To use a behavior in your scene, follow these steps: Create SCNPhysicsBody objects and attach them to each node that participates in the behavior. Create and configure a behavior object joining the physics bodies. See SCNPhysicsBehavior for a list of behavior classes. Call addBehavior(_:) on your scene’s physics world object to add the behavior to the physics simulation.

## See Also

### Registering Physics Behaviors

- [removeBehavior(_:)](scenekit/scnphysicsworld/removebehavior(_:).md)
- [allBehaviors](scenekit/scnphysicsworld/allbehaviors.md)
- [removeAllBehaviors()](scenekit/scnphysicsworld/removeallbehaviors().md)
