ConditionForceEffect.SetParameters 메서드

정의

조건부 힘 피드백 효과에 대한 매개 변수를 설정합니다.

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)

매개 변수

direction
Vector3 Vector3

float3

각 축에 미치는 영향의 방향과 크기를 설명하는 벡터입니다. 각 개별 축의 범위는 -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으로 표시되지만 값을 변경하면 중간 주황색 선이 한 방향으로 또는 다른 방향으로 미끄러집니다.  계수 값으로 정의된 녹색 선의 기울기에는 영향을 주지 않습니다.

적용 대상