Skip to content

Commit 5702416

Browse files
committed
Use generic Input Profile in editor for all controllers types
1 parent 94c7a9b commit 5702416

File tree

1 file changed

+25
-32
lines changed

1 file changed

+25
-32
lines changed

Packages/webxr/Runtime/Scripts/WebXRController.cs

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -452,42 +452,35 @@ private void HandleInputDevicesConnected(InputDevice device)
452452
}
453453
profiles = null;
454454
// TODO: Find a better way to get device profile
455-
if (device.manufacturer == "Oculus")
455+
string profileName = "generic";
456+
bool addedFeatures = false;
457+
float tempFloat = 0;
458+
Vector2 tempVec2 = Vector2.zero;
459+
if (device.TryGetFeatureValue(CommonUsages.trigger, out tempFloat))
456460
{
457-
profiles = new string[]{"oculus-touch-v2"};
461+
profileName += "-trigger";
462+
addedFeatures = true;
458463
}
459-
else
464+
if (device.TryGetFeatureValue(CommonUsages.grip, out tempFloat))
460465
{
461-
string profileName = "generic";
462-
bool addedFeatures = false;
463-
float tempFloat = 0;
464-
Vector2 tempVec2 = Vector2.zero;
465-
if (device.TryGetFeatureValue(CommonUsages.trigger, out tempFloat))
466-
{
467-
profileName += "-trigger";
468-
addedFeatures = true;
469-
}
470-
if (device.TryGetFeatureValue(CommonUsages.grip, out tempFloat))
471-
{
472-
profileName += "-squeeze";
473-
addedFeatures = true;
474-
}
475-
if (device.TryGetFeatureValue(CommonUsages.secondary2DAxis, out tempVec2))
476-
{
477-
profileName += "-touchpad";
478-
addedFeatures = true;
479-
}
480-
if (device.TryGetFeatureValue(CommonUsages.primary2DAxis, out tempVec2))
481-
{
482-
profileName += "-thumbstick";
483-
addedFeatures = true;
484-
}
485-
if (!addedFeatures)
486-
{
487-
profileName += "-button";
488-
}
489-
profiles = new string[]{profileName};
466+
profileName += "-squeeze";
467+
addedFeatures = true;
490468
}
469+
if (device.TryGetFeatureValue(CommonUsages.secondary2DAxis, out tempVec2))
470+
{
471+
profileName += "-touchpad";
472+
addedFeatures = true;
473+
}
474+
if (device.TryGetFeatureValue(CommonUsages.primary2DAxis, out tempVec2))
475+
{
476+
profileName += "-thumbstick";
477+
addedFeatures = true;
478+
}
479+
if (!addedFeatures)
480+
{
481+
profileName += "-button";
482+
}
483+
profiles = new string[]{profileName};
491484
TryUpdateButtons();
492485
SetControllerActive(true);
493486
}

0 commit comments

Comments
 (0)