Skip to content

Commit

Permalink
reverse the settings for jitter
Browse files Browse the repository at this point in the history
  • Loading branch information
YasserNezzari committed Aug 16, 2023
1 parent 42415b0 commit e38a010
Showing 1 changed file with 102 additions and 18 deletions.
120 changes: 102 additions & 18 deletions Source/UltraleapTrackingCore/Private/FUltraleapDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,18 +1223,18 @@ void FUltraleapDevice::SetOptions(const FLeapOptions& InOptions)
case ELeapTrackingFidelity::LEAP_NORMAL:
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpOffset = 500;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = -1.f;
Options.FingerInterpFactor = -1.f;
Options.TimewarpOffset = 2750;
Options.TimewarpFactor = 1.f;
Options.HandInterpFactor = 0.f;
Options.FingerInterpFactor = 0.f;
break;
case ELeapTrackingFidelity::LEAP_SMOOTH:
Options.bUseTimeWarp = false;
Options.bUseInterpolation = true;
Options.TimewarpOffset = 500;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = -1.f;
Options.FingerInterpFactor = -1.f;
Options.TimewarpOffset = 2750;
Options.TimewarpFactor = 1.f;
Options.HandInterpFactor = 0.f;
Options.FingerInterpFactor = 0.f;
break;
case ELeapTrackingFidelity::LEAP_WIRELESS:
if (DeviceType == ELeapDeviceType::LEAP_DEVICE_TYPE_PERIPHERAL)
Expand All @@ -1261,11 +1261,11 @@ void FUltraleapDevice::SetOptions(const FLeapOptions& InOptions)
default:
break;
}
Options.HMDPositionOffset = FVector(90, 0, 0);
}
Options.HMDPositionOffset = FVector(90,0,0);
}

// Rift, note requires negative timewarp!
else if (HMDType == TEXT("OpenXR"))
else if (HMDType == TEXT("OculusHMD") || HMDType == TEXT("OpenXR"))
{
// Apply default options to zero offsets/rotations
if (InOptions.HMDPositionOffset.IsNearlyZero())
Expand Down Expand Up @@ -1319,15 +1319,99 @@ void FUltraleapDevice::SetOptions(const FLeapOptions& InOptions)
default:
break;
}
}
// Pico
else if (HMDType == TEXT("PicoXRHMD"))
{
// Apply default options to zero offsets/rotations
if (InOptions.HMDPositionOffset.IsNearlyZero())
{
// in mm
FVector Offset = FVector(50.0, 0, 0);
Options.HMDPositionOffset = Offset;
}
if (InOptions.HMDRotationOffset.IsNearlyZero())
{
Options.HMDRotationOffset = FRotator(-4, 0, 0); // does it point down because velcro?
}

switch (InOptions.TrackingFidelity)
{
case ELeapTrackingFidelity::LEAP_LOW_LATENCY:
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpOffset = 16000;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = 0.5;
Options.FingerInterpFactor = 0.5f;

break;
case ELeapTrackingFidelity::LEAP_NORMAL:
if (DeviceType == ELeapDeviceType::LEAP_DEVICE_TYPE_PERIPHERAL)
{
Options.TimewarpOffset = 20000;
}
else
{
Options.TimewarpOffset = 25000;
}
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = 0.f;
Options.FingerInterpFactor = 0.f;
break;

case ELeapTrackingFidelity::LEAP_SMOOTH:
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpOffset = 26000;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = -1.f;
Options.FingerInterpFactor = -1.f;
break;
case ELeapTrackingFidelity::LEAP_CUSTOM:
break;
default:
break;
}
}

// Cardboard and Daydream
else if (HMDType == TEXT("FGoogleVRHMD"))
{
if (InOptions.HMDPositionOffset.IsNearlyZero())
{
// in mm
FVector DayDreamOffset = FVector(80.0, 0, 0);
Options.HMDPositionOffset = DayDreamOffset;
}

switch (InOptions.TrackingFidelity)
{
case ELeapTrackingFidelity::LEAP_LOW_LATENCY:
case ELeapTrackingFidelity::LEAP_NORMAL:
case ELeapTrackingFidelity::LEAP_SMOOTH:
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpOffset = 10000;
Options.TimewarpFactor = 1.f;
Options.HandInterpFactor = -1.f;
Options.FingerInterpFactor = -1.f;
break;
case ELeapTrackingFidelity::LEAP_CUSTOM:
break;
default:
break;
}

// let's use basic vive settings for cardboard for now
}
else // For android
// Other, e.g. cardboard
else
{
Options.TimewarpOffset = 16000;
Options.bUseTimeWarp = true;
Options.bUseInterpolation = true;
Options.TimewarpFactor = -1.f;
Options.HandInterpFactor = -2.2;
Options.FingerInterpFactor = -2.2;
// UE_LOG(UltraleapTrackingLog, Log, TEXT("%d doesn't have proper defaults
// set yet, using passed in custom settings."), HMDType);
}
}
// HMD offset not allowed in OpenXR (already corrected)
Expand Down

0 comments on commit e38a010

Please sign in to comment.