Added an option to completely disable position outlier caused recalibration.

This commit is contained in:
Emiliana 2020-07-25 18:14:30 +02:00
parent 1b1c6a179f
commit e8e40ef63d

View file

@ -37,6 +37,8 @@ public class OpenSeeIKTarget : MonoBehaviour
public float outlierThresholdDistance = 2f; public float outlierThresholdDistance = 2f;
[Tooltip("This sets the number of seconds for which distance outliers are ignored before being accepted. Once this period elapses, automatic recalibration is triggered. Setting this to zero will disable outlier skipping.")] [Tooltip("This sets the number of seconds for which distance outliers are ignored before being accepted. Once this period elapses, automatic recalibration is triggered. Setting this to zero will disable outlier skipping.")]
public float outlierSkipPeriodDistance = 0.4f; public float outlierSkipPeriodDistance = 0.4f;
[Tooltip("If set to true, persistent positional outliers will cause automatic recalibration.")]
public bool outlierRecalibrate = false;
[Tooltip("If set to true, recalibration caused by positional outliers will keep the current position and rotation of the head.")] [Tooltip("If set to true, recalibration caused by positional outliers will keep the current position and rotation of the head.")]
public bool outlierKeepOffset = false; public bool outlierKeepOffset = false;
[Header("Information")] [Header("Information")]
@ -162,9 +164,11 @@ public class OpenSeeIKTarget : MonoBehaviour
if (Time.time > skipStartTimePosition + outlierSkipPeriodDistance) { if (Time.time > skipStartTimePosition + outlierSkipPeriodDistance) {
lastAcceptedPosition = t; lastAcceptedPosition = t;
skippedPosition = false; skippedPosition = false;
calibrate = true; if (outlierRecalibrate) {
keepOffset = outlierKeepOffset; calibrate = true;
outlierCalibrations += 1; keepOffset = outlierKeepOffset;
outlierCalibrations += 1;
}
} }
} }
} else { } else {