Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Cross platform controller support for Unity XR and WebVR. #306

Merged
merged 12 commits into from
Jun 27, 2018

Conversation

caseyyee
Copy link
Contributor

@caseyyee caseyyee commented Jun 22, 2018

This PR adds ability to map create input gestures and map them to the appropriate Unity XR (Using Unity Input Manager) or Web gamepad API input systems.

This enables us to easily work between the Unity and WebVR using a single control scheme.

This includes changes from #295 which has now been closed in favor of this PR.

Fixes issues #233

@caseyyee caseyyee requested a review from cvan June 22, 2018 23:22
Copy link
Contributor

@cvan cvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first off, great job on the refactor 👍

in addition to handling #295, can you mention in the commit message which issue this fixes? or what in particular should I be testing for that's not covered in #295?

most important item to address: the trigger-button logic presses seem to have regressed for picking up objects.

let me know when you need another look at this. thanks, @caseyyee!

void Update()
{
// Use Unity XR Input when enabled. When using WebVR, updates are performed onControllerUpdate.
if (UnityEngine.XR.XRDevice.isPresent)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to handle when an XR device is not present?

return false;
}

private void onControllerUpdate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want to capitalise the O?

public string unityInputName;
[Tooltip("gesture derives its values from a Unity button input.")]
public bool unityInputIsButton;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a newline at EOF

public string actionName;

[Header("Web Gamepad API configuration")]
[Tooltip("button or axes ID from Web Gamepad API.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make sure all the tooltips start with capitalised letters?

descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which controller does this correspond to? can we add a descriptiveName?

[Header("Web Gamepad API configuration")]
[Tooltip("button or axes ID from Web Gamepad API.")]
public int gamepadId;
[Tooltip("gesture derives its values from a gamepad API button.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capitalise: Gamepad

and if you're saying Web Gamepad above, should probably use the same here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we prefix this with Whether, since it's a boolean?

[Header("Unity Input Manager configuration")]
[Tooltip("button name defined in Unity Input Manager.")]
public string unityInputName;
[Tooltip("gesture derives its values from a Unity button input.")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -0,0 +1,6 @@
%YAML 1.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this file for?


if (controller != null)
if (controller.GetButtonDown("Trigger"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something appears to have regressed here. I can pick up objects, but if I press the trigger a few times, the next time I go near an object, it moves when I just wave my hand near it. I don't have to press the trigger button any more. my hand becomes like a magnet, moving the ball wherever my hand is.

to reproduce, just pick up the object and press the trigger button a few times. you should see what I'm talking about. comment back here or message me on Slack if you can't reproduce.

@caseyyee caseyyee changed the title Adds support for controller axes Cross platform controller support for Unity XR and WebVR. Jun 26, 2018
@caseyyee
Copy link
Contributor Author

Will merge this in the interest of moving fast, @cvan will follow up with another review.

@caseyyee caseyyee force-pushed the axis branch 2 times, most recently from 2e5fb6c to d410152 Compare June 26, 2018 23:58
@caseyyee caseyyee merged commit cde23e3 into MozillaReality:master Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants