<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNMorpher/setWeight(_:forTargetAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SCNMorpher(im)setWeight:forTargetAtIndex:"
  },
  "title" : "setWeight(_:forTargetAt:)"
}
-->

# setWeight(_:forTargetAt:)

Specifies a weight value at a specified target index.

```
func setWeight(_ weight: CGFloat, forTargetAt targetIndex: Int)
```

## Parameters

`weight`

A number specifying the contribution of the target geometry to the blended surface, generally between `0.0` and `1.0`.

`targetIndex`

The index of a geometry in the morpher’s [`targets`](/documentation/SceneKit/SCNMorpher/targets) array.

## Discussion

Target geometries and their weights determine the current form of the surface produced by the morpher. For example, if a morpher has one target whose weight is `0.5`, the form of the resulting surface will be halfway between those of the base geometry and the target geometry.

You can also animate weights implicitly or explicitly using the keypath `weights[index]`, where `index` corresponds to the `targetIndex` parameter of this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)