---
title: "setTorque(_:index:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/forceeffectparameters/settorque(_:index:)"
---

# setTorque(_:index:)

Sets the torque for each rigid body.

## Declaration

```swift
func setTorque(_ torque: SIMD3<Float>, index: Int)
```

## Parameters

- `torque`: The torque value.
- `index`: The index to the rigid body. The index should be in the range [0, doc://com.apple.RealityKit/documentation/RealityKit/ForceEffectParameters/physicsBodyCount].

## Discussion

Discussion Inside the force effect update function, you are responsible to compute and output the torque by calling this function for each rigid body. If you omit this function for a rigid body, that rigid body gets zero torque from the effect.
