Exemple #1
0
    private void OnModelChanged(FloatModel model)
    {
        SetUi();

        float delta = Mathf.Abs(lastModelValue - model.GetValue());

        float intensity = delta / 0.05f;

        if (grabbedState == GrabbedState.Grabbed)
        {
            TriggerHapticPulses(0.025f * intensity, 0.075f * intensity);
        }
        lastModelValue = model.GetValue();
    }
Exemple #2
0
    private void SetUi()
    {
        float   value         = model.GetValue();
        Vector3 completeSlide = sliderEnd.localPosition - sliderStart.localPosition;
        Vector3 buttonPos     = sliderStart.localPosition + completeSlide * value;

        if (value > 1)
        {
            value = 1;
            buttonTransform.localPosition = sliderEnd.localPosition;
        }
        else if (Vector3.Distance(sliderStart.localPosition, sliderEnd.localPosition) <= Vector3.Distance(sliderEnd.localPosition, buttonPos))
        {
            value = 0;
            buttonTransform.localPosition = sliderStart.localPosition;
        }
        else
        {
            buttonTransform.localPosition = buttonPos;
        }
    }
 private void OnScaleChanged(FloatModel scale)
 {
     SetScaleValue(scale.GetValue());
 }
 private void OnRotateChanged(FloatModel rotate)
 {
     SetRotationValue(rotate.GetValue());
 }
 void Start()
 {
     SetRotationValue(rotateModel.GetValue());
     SetScaleValue(scaleModel.GetValue());
 }