> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IGameInputForceFeedbackEffect::SetGain

> IGameInputForceFeedbackEffect::SetGain

# IGameInputForceFeedbackEffect::SetGain

設定力回饋效果的增益。

## 語法

```cpp theme={null}
void SetGain(
    float gain
);
```

### 參數

*gain*   \_In\_\
類型：float

套用至力回饋效果的新增益。

### 傳回值

無

## 備註

力回饋馬達上的增益值可介於 0.0 到 1.0 之間。

有兩種增益會影響力回饋效果的強度。一種是由 [IGameInputDevice::SetForceFeedbackMotorGain](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setforcefeedbackmotorgain.md) 在馬達上設定的增益，另一種則是由此函式在效果本身上設定的增益。

兩種增益的效果會相乘。如果效果增益設定為 0.5，且馬達的主要增益設定為 0.5，則效果會以 0.25 的強度播放。如需詳細資訊，請參閱[進階 GameInput 主題](https://docs.xbox.com/zh-TW/build/core-features/common/input/advanced/input-advanced-topics.md)。

## 需求

**標頭：** GameInput.h

[GameInput 概觀](https://docs.xbox.com/zh-TW/build/core-features/common/input/overviews/input-overview.md)\
[IGameInputForceFeedbackEffect::GetGain](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_getgain.md)\
[IGameInputDevice::SetForceFeedbackMotorGain](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputdevice/methods/igameinputdevice_setforcefeedbackmotorgain.md)\
[IGameInputForceFeedbackEffect](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/igameinputforcefeedbackeffect.md)

## 版本歷程記錄

| 版本 | 變更 |
| - | - |
| **v0** | 推出。 |


## Related topics

- [IGameInputForceFeedbackEffect::GetGain](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_getgain.md)
- [GameInput 上的力回饋](https://docs.xbox.com/zh-TW/build/core-features/common/input/advanced/input-forcefeedback.md)
- [IGameInputForceFeedbackEffect (介面內容)](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/igameinputforcefeedbackeffect.md)
- [IGameInputForceFeedbackEffect::SetState](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_setstate.md)
- [IGameInputForceFeedbackEffect::SetParams](https://docs.xbox.com/zh-TW/reference/input/gameinput/interfaces/igameinputforcefeedbackeffect/methods/igameinputforcefeedbackeffect_setparams.md)
