-
Notifications
You must be signed in to change notification settings - Fork 127
Cross platform controller support for Unity XR and WebVR. #306
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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; | ||
} |
There was a problem hiding this comment.
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.")] |
There was a problem hiding this comment.
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?
ProjectSettings/InputManager.asset
Outdated
descriptiveName: | ||
descriptiveNegativeName: | ||
negativeButton: | ||
positiveButton: joystick button 14 |
There was a problem hiding this comment.
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.")] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
ProjectSettings/PresetManager.asset
Outdated
@@ -0,0 +1,6 @@ | |||
%YAML 1.1 |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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.
Will merge this in the interest of moving fast, @cvan will follow up with another review. |
2e5fb6c
to
d410152
Compare
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