ConditionForceEffect.SetParameters メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
条件付き強制フィードバック効果のパラメーターを設定します。
public:
virtual void SetParameters(float3 direction, float positiveCoefficient, float negativeCoefficient, float maxPositiveMagnitude, float maxNegativeMagnitude, float deadZone, float bias) = SetParameters;
void SetParameters(float3 const& direction, float const& positiveCoefficient, float const& negativeCoefficient, float const& maxPositiveMagnitude, float const& maxNegativeMagnitude, float const& deadZone, float const& bias);
public void SetParameters(Vector3 direction, float positiveCoefficient, float negativeCoefficient, float maxPositiveMagnitude, float maxNegativeMagnitude, float deadZone, float bias);
function setParameters(direction, positiveCoefficient, negativeCoefficient, maxPositiveMagnitude, maxNegativeMagnitude, deadZone, bias)
Public Sub SetParameters (direction As Vector3, positiveCoefficient As Single, negativeCoefficient As Single, maxPositiveMagnitude As Single, maxNegativeMagnitude As Single, deadZone As Single, bias As Single)
パラメーター
各軸に対する効果の方向と大きさを記述するベクター。 各軸の範囲は -1.0 から 1.0 で、他の軸とは独立しています。 軸に負の値を指定すると、入力値が軸から反転します。
- positiveCoefficient
-
Single
float
入力が指定した軸に沿って正の方向の中心点から離れるにつれて、力がどれだけ速く増加するかを示す線の傾き。 範囲は -infinity から +infinity です。
- negativeCoefficient
-
Single
float
入力が指定した軸に沿って負の方向の中心点から離れるにつれて、力がどれだけ速く増加するかを示す線の傾き。 範囲は -infinity から +infinity です。
- maxPositiveMagnitude
-
Single
float
入力が指定した軸に沿って正方向の中心点から離れる場合の力フィードバックの最大大きさ。 範囲は 0 から 1.0 です。
- maxNegativeMagnitude
-
Single
float
入力が指定した軸に沿って負の方向の中心点から離れる場合の力フィードバックの最大大きさ。 範囲は 0 から 1.0 です。
- deadZone
-
Single
float
フォース フィードバックが適用されない値を指定します。 範囲は 0.0 ~ 1.0 で、中心点の周りに非対称に適用されます。
- bias
-
Single
float
有効な計算の中心点へのオフセット。 範囲は -1.0 から 1.0 です。
例
// Create a spring effect and load it into the device. This is an async operation
// since it might take a brief amount of time for the driver to complete this.
ConditionForceEffect ^ springEffect = ref new ConditionForceEffect(ConditionEffectKind::Spring);
if (springEffect)
{
IAsyncAction ^ action = motor->LoadEffectAsync(springEffect);
concurrency::create_task(action).then([=]()
{
// Make sure the effect was loaded successfully. There is a finite amount
// of storage available for effects in the hardware, so this is expected
// to fail if there is not enough room. Alternatively, the motor might
// not support the requested effect (although this is rare).
if (action->Status == AsyncStatus::Completed)
{
// Set the parameters for the spring effect. Note how the parameters
// can be modified after the effect has been loaded into the hardware.
springEffect->SetParameters(
{ 1.0f, 0.0f, 0.0f }, // Unit vector indicating the effect applies to the X axis
1.0f, -1.0f, // Full strength when the wheel is turned to its maximum angle
0.3f, -0.3f, // Limit the maximum feedback force to 30%
0.025f, // Apply a small dead zone when the wheel is centered
0.0f); // Equal force in both directions
// Go ahead and start the effect, since we want this running all the time
springEffect->StartEffect();
}
});
}
注釈
次の図は、引数が SetParameters に及ぼす影響を示しています。
画像では、すべての係数値が正です。 係数に負の値を指定すると、力 (緑色の線) がオレンジ色の軸線の下に負になり、効果的に力の方向が反転します。 慎重に行わない限り、通常は正のフィードバック ループが発生し、モーターがその方向に飽和するため、これはお勧めしません。 大きさとデッド ゾーンの値は常に正であり、それぞれの軸に対して対称です。 (これはデッド ゾーンに対して示されていますが、大きさは同じように機能します。値が 0.5 の場合、フィードバックフォースは -0.5 ~ +0.5 の任意の場所に制限されます)。バイアスは0.0でここに示されていますが、値を変更すると、オレンジ色の中程度の線がどちらか一方にスライドするだけです。 これは、係数値によって定義される緑色の線の傾きには影響しないことに注意してください。