How to Setup XR Toolkit's Action-Based Input in Unity

  Рет қаралды 54,297

VR with Andrew

VR with Andrew

Күн бұрын

Пікірлер
@CitizenPurpelios
@CitizenPurpelios 4 жыл бұрын
amazing that you posted this today I JUST needed this.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Glad to be of assistance!
@WilkoGRACZ
@WilkoGRACZ 4 жыл бұрын
Andrew, thank you so much! My game has gone through 3 toolkits and this is now my final one. Professional to the point videos and nice voice! :)
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
You're very welcome, Wilko! I'm glad you enjoyed them.
@Colab-Film
@Colab-Film 3 жыл бұрын
Thank you so much! Im just getting started with Unity and vr-Dev and its so frustrating that the Unity-interface has changed so much in one year and its hard to set the inputs right with all the different Versions people in Tutorials explain! So thankful to find you explaining it propperly for the setup in 2021.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Glad to help!
@c0d3_m0nk3y
@c0d3_m0nk3y Жыл бұрын
This is one of the most helpful Unity tutorials, I have ever seen! Thank you so much!
@CastleBomber
@CastleBomber Жыл бұрын
dope! got through a hurdle, thanks man
@genemedicd
@genemedicd 3 жыл бұрын
Pure gold! I was having so much trouble and I was missing adding the Input Action Manager script. Thanks so much!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@valentinsourice3780
@valentinsourice3780 4 жыл бұрын
This is gold, thanks for keeping us up to date
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Of course!
@colincreamer
@colincreamer 3 жыл бұрын
Sweet! This is supported natively now! 5 months before this video came out, i had Modified XR's Controller script to have public faceing functions so i could pass though Select and Activate actions via script. In a hakish way i could still use unitys Input system for all the controlls, and still pass them through to VR. Allowed me to simultaneously have keyboard, mouse, gamepad and oculus controller trigger things like teleportation. After seeing this video, i can now revisit this and do it properly without the need for modified library code as this type of functionality is now natively suported between the input system with the XR toolkit! Thanks!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@josemartins-game
@josemartins-game 8 ай бұрын
Interesting. But how do we actually read the controller buttons ? Example A and B buttons on a meta quest controller ?
@vitnovak
@vitnovak 3 жыл бұрын
O M G! You actually go to the documentation and explain all the "whys"! This is so awesome!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Glad you found it useful!
@citywizardgames
@citywizardgames 2 жыл бұрын
You're my hero, I was beating my head against the terrible default Unity instructions on this all week. Cheers man.
@VRwithAndrew
@VRwithAndrew 2 жыл бұрын
Happy to help!
@Diablokiller999
@Diablokiller999 4 жыл бұрын
So this is how it works, didn't get my head around it for the last few days, thank you so much! :)
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Glad it helped!
@VeryDavidChannel
@VeryDavidChannel 4 жыл бұрын
By the way, the presets that you download do not have to be added to the 'Preset Manager' and labeled 'left' and 'right'. You can just create an XRRig, and then click on the individual left and right controllers, and choose the presets by clicking on the small 'preset' button in the inspector at the top right, by the help and more buttons. Thought I'd share since I ran into that!
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
@@VeryDavidChannel Yep! This can also be found in the Presets Documentation that a pinned.
@PhillipsAlbright
@PhillipsAlbright 2 жыл бұрын
great explanation of this system, even after two years.
@VRwithAndrew
@VRwithAndrew 2 жыл бұрын
Happy to help!
@cedricknapp2889
@cedricknapp2889 4 жыл бұрын
Thanks Andrew! Had just read up on the new input system and I learned about it in terms of normal kB &mouse & gamepads, so it was nice to see how it applies to the XR toolkit now! :)
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
You're welcome, Cedric!
@mewing55
@mewing55 3 жыл бұрын
extremely helpful tutorial. combines a lot of info in a short time. great work!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Much appreciated!
@Xzarations
@Xzarations 4 жыл бұрын
Does this support valve index controllers yet?
@DeGandalf
@DeGandalf 4 жыл бұрын
I have the same question, it would be great if someone knew this.
@Xzarations
@Xzarations 4 жыл бұрын
@@DeGandalf yeah I have been waiting for better index support for ages
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
It's limited Index Support in Unity 2019. You'll need to keep a look out for Unity's Beta OpenXR integration that'll hopefully be out by the end of the year.
@Xzarations
@Xzarations 4 жыл бұрын
@@VRwithAndrew Thanks! I have been using steamvr sdk for over a year and I can’t wait to switch so that I can support multiple devices!
@IProKv
@IProKv 3 жыл бұрын
THANK YOU ANDREW YOU LOOK AFTER US HOMIE, DIVINES BLESS YOU MY MAN
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Anytime, homie
@johnjohnhenry7645
@johnjohnhenry7645 4 жыл бұрын
GENIUS !!! I spent two days trying to understand that !
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Now we're both geniuses!
@coatube
@coatube 3 жыл бұрын
best tutorial for biginner of xr toolkits . very awesome!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Much appreciated!
@petacardi
@petacardi 3 жыл бұрын
Oh, man, thank you! I was missing the Input Action Manager. Great channel, very useful for beginners like me.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help, Franco!
@frozensmoketrails
@frozensmoketrails 3 жыл бұрын
Thank you for this video!! This is stuff that should be in the official docs to begin with.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@dustinmilotte8852
@dustinmilotte8852 4 жыл бұрын
How can I read trigger value with the new input system? meaning I want to poll in update for the current amount the trigger is pressed, giving values between 0-1. The Activate action in the default set seems to only be a button.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
If you go into the action set and select the Activate action. You'll just need to change it from a Button to a Value, and set it as an Axis.
@adhochero6619
@adhochero6619 4 жыл бұрын
Thanks for the dope tut. I had a question how can you then use the inputs? when I first looked at new input system, a couple days ago, I used the Player Input component to gain access to the actions. but with the right and left controller being separate action maps you can only use one or the other for the Player Input. Im just not sure how to actually use the input to do things now.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
There may be a more permanent solution in the future, but the Input Action Manager kinda does what the Player Input component does. Only that it enables all of the Actions within each Action Set, instead of how the Player Input does it on a per Action Set basis. One way of checking for additional Input is to use the Input Action References. There should be a section on how to do this in the New Input System manual. docs.unity3d.com/Packages/com.unity.inputsystem@0.2/manual/Actions.html
@davidblissett5315
@davidblissett5315 3 жыл бұрын
Thanks for showing us the way Man. Such great content. Really appreciated.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@NightSpyderTech
@NightSpyderTech 4 жыл бұрын
Awesome! Can't wait for an update to the interaction system with this new method, especially the new hand interaction / posing stuff. Also really happy to finally be able to leave the legacy vr system for cross platform setup.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Aren't we all! I'm glad we're finally getting a more straightforward solution.
@mireazma
@mireazma 2 жыл бұрын
how to actually link the actions in XR Controller (6:30) to methods?
@VRwithAndrew
@VRwithAndrew 2 жыл бұрын
All of those actions are set up to select, activate, and all that. If you're trying to do additional actions for the XR Controller, it's possible but overly in-depth to do. I do cover more customization for actions in my Custom XR Actions video.
@davidgarrett30
@davidgarrett30 3 жыл бұрын
Currently trying to get a button click working and it isn't. A video on that would be sweet.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
I have a Custom Input Actions video that may help you.
@ELPIRATATUQUE
@ELPIRATATUQUE 3 жыл бұрын
Awesome, Would like to use movement with Actionbased XR, any vids?
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Not exactly, but I do have this video that shows how to implement XR Toolkit's built-in locomotion. kzbin.info/www/bejne/aojMfqKdoMqjZ7c
@WTGDarksight
@WTGDarksight 3 жыл бұрын
Thank you for the video! It helped a lot. Just wondering if there is an easy way to also add primary and secondary buttons because I noticed they were not added by default
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Yeah! It just depends if you're just doing the basic inputs, or have it work on the currently selected object. For the basics, I'd say look into a generic New Input System video for creating actions. You can then create a new action either using the Generic XR Controller or specifically Vive and Index if you're using OpenXR.
@Palatard
@Palatard Жыл бұрын
But how do I bind a button to a custom function? I don't understand how to make the character sprint with the press of a button with this new system.
@VRwithAndrew
@VRwithAndrew Жыл бұрын
I have an additional video on this, "Custom Input Actions for Unity XR."
@Palatard
@Palatard Жыл бұрын
@@VRwithAndrew Thank you friend. I kept finding actual button game object videos when searching for how to bind buttons.
@Igi-kai
@Igi-kai 3 жыл бұрын
Thank you Andrew! Your video has saved me a lot of time! :)
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help, Igor!
@javhus
@javhus 3 жыл бұрын
How do you detect button presses? Like the X and Y buttons on the oculus quest controllers for example?
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
That would be the Primary or Secondary button inputs for the Generic Controller. But, if you're using OpenXR you can access the inputs on a per controller basis if you want to be more specific.
@exof8824
@exof8824 3 жыл бұрын
@@VRwithAndrew Is there an easy way to change what those buttons do depending on other things? Like if you're holding something the primary button does one thing, but if you're holding something different it does something else?
@flurishart612
@flurishart612 3 жыл бұрын
I have watched your videos on the action based input system multiple times but I am still confused on one thing. If you for example create an action called "test" and bind it to the primary button of the right hand controller, how can you do something when that button is pressed? I'm trying to reference a variable storing the ActionBasedController component, called controller. I can for example do bool buttonPressed = controller.selectAction.action.ReadValue(); to see if the select action is being pressed, but when I replace select with test, test beign the action I created in the action window, it wont work. Is there something else I have to do to check if an action I added is being pressed? Thx.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
That should work! Make sure you've saved the Input Asset, also assuming that all your actions are also being enabled in the Input Action Manager script.
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew Oh so I would need to write another line of code to enable the "test" action that I created in the action input window? How would u do that?
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew Yeah I'm trying this but it's not working, it's telling me "testAction" isn't valid I must be missing the step to enable it if there's something additional you have to do besides adding it in the action input window: buttonPressed = controller.testAction.action.ReadValue();
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
@@flurishart612 Depending upon how to have the action setup, you may want to try reading it as a float.
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew Yeah I'm honestly just trying to run code when the primary button on the right controller is pressed it's crazy how hard this seems to be with the new input system I've seen a lot of other comments with this same issue too I don't get what I'm missing. I double click the default Input actions asset, it pops open the action input window. On the left it has XRI HMD, XRI LeftHand, and XRI RightHand. I click XRI RightHand. Then, in the middle column, I click the + symbol. I name the new action "Test", the action type parameter is set to button. Then I click the + symbol next to that and click "add binding", and I add the primaryButton binding from generic XR controller stuff. It just doesn't let me use "Test" in my code. Here is the full code I'm using: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.XR.Interaction.Toolkit; public class ActionInputTest : MonoBehaviour { private bool buttonPressed; //bool that stores true or false if button is pressed private ActionBasedController controller; private void Start() { controller = GetComponent(); } void Update() { //buttonPressed = controller.selectAction.action.ReadValue(); //this code works buttonPressed = controller.testAction.action.ReadValue(); //this code doesnt, can't find testActions if(buttonPressed == true) { Debug.Log("Button Pressed"); } } }
@ownedge7329
@ownedge7329 3 жыл бұрын
Might be a stupid question, but when I click RMB in Hierarchy it shows only XR options without "(Action-based)", what could be wrong? Also when I click on Default Input Actions Presets - Inspector says "Unable to load this Preset, the type is not supported" =(
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Double-check you're on a more recent version, and that there isn't a submenu for action-based components. You're only able to apply presets if you're using the correct component. Which, may explain why you can't apply the action presets.
@ownedge7329
@ownedge7329 3 жыл бұрын
@@VRwithAndrew Thanks! After I've updated OpenXR from 1.2.6 to 1.2.8 it finally appeared! Or editor just needed a reload for something to be applied, idk honestly, but I'm happy now, thank you!)
@imdixon8108
@imdixon8108 3 жыл бұрын
Is there a tldr on how to setup a new action? I'm trying to subscribe to a primary button action, set it up in the action menu and mapped it to generic XR left hand. How can I access this in code to subscribe to the event, though?
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
If you look into my OpenXR video/template project there is an example there for subscribing to an input's events.
@FPChris
@FPChris 3 жыл бұрын
Do you change the Main Camera's position on it's transform or the Camera Offset's transform? Thx
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Main Camera's position
@FPChris
@FPChris 3 жыл бұрын
@@VRwithAndrew Thx!
@FlyingNotebook-e9p
@FlyingNotebook-e9p 3 жыл бұрын
I updated the XR Interaction Toolkit to import the Default Input Action. However, as soon as I imported it, I saw the function [protected void OnSelectEnter (XRBaseinteractor)] part of Interactables' AxisDragInteractable.cs error occurred. I want to ask if there is a solution.
@FlyingNotebook-e9p
@FlyingNotebook-e9p 3 жыл бұрын
It is said that no suitable method was found to override.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
@@FlyingNotebook-e9p When you're using updated version of XR Toolkit, they've updated to use EventArguments. I cover this at the beginning of my Bow and Arrow 2.0 video.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
If you'd like to know more about saving and apply presets check out this manual from Unity. docs.unity3d.com/Manual/Presets.html
@PhillipsAlbright
@PhillipsAlbright 2 жыл бұрын
How do you assign new actions to controls?
@VRwithAndrew
@VRwithAndrew 2 жыл бұрын
Everything gets funneled into the Select, and Activate via the XRController. If you're looking at more functionality, that's a bit of a process that I don't have a video on.
@valentinsourice3780
@valentinsourice3780 4 жыл бұрын
Hello, I'm trying to use this action-base input system but I can not give the "XRI Default Input Actions" Asset to my script, it does not show up in the inspector ; do you have any idea ? I did this [SerializeField] public XRIDefaultInputActions Controls;
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
You'll want to use the type "InputActionAsset" rather than "XRIDefaultInputActions".
@valentinsourice3780
@valentinsourice3780 4 жыл бұрын
​@@VRwithAndrew Thanks for your answer ! it puts me on rails. I used XRIDefaultInputActions because I wanted to use the Unity C# generated class from the input asset package example. Giving it from the inspector like I tried to do is obsolete ; now you need to do instantiate it directly from code like this : var test = new XRIDefaultInputActions();
@ikramandaliff
@ikramandaliff 4 жыл бұрын
Hey man i just wanted to know if it possible to create a spectator camera inside a vr scene with unity xr input management. I wanted to make a controlable spectator camera with mouse and keyboard but the xr input wont let me
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
In theory, I think you'd be able to do it. If you can get the camera and everything setup correctly. You may need to look into how the Input System handles multiplayer. Or, you may be able to get away with writing your own script to Activate all of the actions, and have the functionality you want hooked up to them. You can see more of that here. docs.unity3d.com/Packages/com.unity.inputsystem@0.2/manual/Actions.html
@ikramandaliff
@ikramandaliff 4 жыл бұрын
@@VRwithAndrew thanks alot man! At the moment the xr input is disabling my camera control script and mouse input, need to find a way around it
@joel352
@joel352 4 жыл бұрын
This is great, thank you! Now I am having issues using the XR Device Simulator when trying to control the virtual HMD. I am trying to apply the same principals but I can't seem to get it.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
I tried the Device Simulator awhile back and for whatever reason, I struggled to get it to do a whole lot. It's still real early, and not well documented so I haven't done too much with it.
@danielstrobel8369
@danielstrobel8369 3 жыл бұрын
Nice Tut. Is there a way to control the XR Rig via Android Smartphone? I tried to use: device rotation[HandheldARInputDevice] device rotation[OpenVR Headset] attitude[Sensor] But via Unity Remote 5 nothing happens. Do I have to set up my device differently?
@danielstrobel8369
@danielstrobel8369 3 жыл бұрын
Running the API also doesnt work. And anyway the workflow is too slow to test it like that.
@egrinant2
@egrinant2 4 жыл бұрын
Thanks for the info, I have been struggling for hours before watching your video. Now I could finally make the controllers work! However I have a problem with the camera, it doesnt seem to be tracking, not even the rotation. I have the project set with the new input system and followed your instructions. Headset is an Oculus Quest 2. Any suggestion? Thanks!!
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
I'm not sure about that! What version of Unity are you using? If you go to the Camera's GamObject, does it have an Action-Based poser on it?
@egrinant2
@egrinant2 4 жыл бұрын
​@@VRwithAndrew Thanks for your help, it was in the Camera, Track Pose Driver (New Input System), I had to put Position and Rotation Action to specifically target Oculus Headset, any other preset won't work. You pointed me in the right direction!
@akravatorwind8976
@akravatorwind8976 3 жыл бұрын
@@egrinant2 Edgar, I encounter similar problem with you with my oculus quest. May i know which preset you are end up using ? I have tried Device and Center Eye Oculus. but none works.
@egrinant2
@egrinant2 3 жыл бұрын
@@akravatorwind8976 centerEyePosition [Oculus Headset] and centerEyeRotation [Oculus Headset]
@yohosuff
@yohosuff 3 жыл бұрын
@@akravatorwind8976 I was able to solve this problem by following the advice here: forum.unity.com/threads/xr-interaction-toolkit-0-10-preview-is-available.1000576/#post-6497878. My problem was Active Input Handling was set to "Input Manager (old)" in Project Settings > Player.
@dimensional7915
@dimensional7915 4 жыл бұрын
now this is what we call progress
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
We're getting there!
@mboe94
@mboe94 3 жыл бұрын
How do I use this if I want a debug.log when I press A,B X or Y on my Quest2? Do you have a script for that? Been searching for this info the past 4 days, can't move on until I know how.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
I'm putting together a simple project on this since it's a very common question. In the meantime, I would recommend looking into more generic Input System videos, and my OpenXR video. It has some info on input as well.
@mboe94
@mboe94 3 жыл бұрын
@@VRwithAndrew Fantastic! Looking forward to watching it ! :)
@WesleyOverdijk
@WesleyOverdijk 4 жыл бұрын
Have you figured out how to use this with XRGrabInteractables? i can't get onActivate to trigger, and the weapon I'm holding just rotates like it's inside of a microwave.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Ahaha, what controller are you using?
@WesleyOverdijk
@WesleyOverdijk 4 жыл бұрын
@@VRwithAndrew I have since figured it out. It was rotating because that's what the rotate anchor input does. I had to disable that. The trigger wasn't working because I'm a moron and I forgot that I had copied a scene (and didn't include it in the build). Thanks for the reply 😄
@markus6056
@markus6056 2 жыл бұрын
3:57 Unity have change the name from Default Input Actions to Starter Assets
@pratiklohokare8591
@pratiklohokare8591 3 жыл бұрын
thank you so much bro, for this detailing
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@davidosorio1585
@davidosorio1585 3 жыл бұрын
How can i read the buttons values from a script?
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
If you look into more generic Input System videos, they should show you how to use the ReadValue function. I touch on it at the end of my OpenXR video.
@Timotheeee1
@Timotheeee1 3 жыл бұрын
so there's a rotation "action" but how do you actually get the rotation out of it ? the only parameter is a callback: controller.rotationAction.action.performed += (UnityEngine.InputSystem.InputAction.CallbackContext obj) => { };
@pohyart
@pohyart 3 жыл бұрын
You can actually poll actions: docs.unity.cn/Packages/com.unity.inputsystem@1.0/manual/Actions.html#polling-actions
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
@@pohyart This is correct, you can use the ReadVaue method.
@flurishart612
@flurishart612 3 жыл бұрын
I was having issues making code run when the primaryButton on the right controller was pressed. After a real long time messing with this I was able to get it working, wanted to share in case someone else was having this issue. First, go double click your XRI Default Input Actions asset. Click XRI RightHand in the left column, and then click the + symbol in the middle column to create your action. I named mine Test, click it and set the Action Type in the right colum to button, then click the + symbol next to Test and click Add Binding. Click the new binding, and then in the path parameter in the right column navigate to the primaryButton for the XR controllers, check the "Generic XR Controller" checkbox. Once the Test action is created in the input action window you have to add it to the ActionBasedController script, this is what was throwing me off. Open that script and add the following, this will allow you to reference the Test action in other scripts: [SerializeField] InputActionProperty m_TestAction; public InputActionProperty testAction { get => m_TestAction; set => SetInputActionProperty(ref m_TestAction, value); } Once you have done that you can reference this action in code. The buttons are weird with this system btw too, the button press will return a float and not a bool like you would think. To make something happen when the button is pressed do if (buttonPressed > 0) instead of if(buttonPressed == true), you could also create a function and have it run when the button is triggered here is the code I used: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.XR.Interaction.Toolkit; public class ActionInputTest : MonoBehaviour { private float buttonPressed; //bool that stores true or false if button is pressed private ActionBasedController controller; private void Start() { controller = GetComponent(); } void Update() { buttonPressed = controller.testAction.action.ReadValue(); if (buttonPressed > 0) { Debug.Log("Button Pressed"); } } }
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
If you're simply trying to read the value, you don't have include it in the controller. Also, the scripts that are included in Packages aren't saved between Unity re-loads. You can very well do the same thing using this script. github.com/C-Through/XR-OpenXR/blob/main/Assets/_OpenXR/Scripts/AssetInputExample.cs
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew Hi Andrew, sorry I'm not sure what you are explaining with this script. Are you stating that I don't need to alter the ActionBasedController using the script you provided? And yes, just simply trying to tell if the primaryButton on the right hand is pushed, and if it gets pushed run some code. I'm still not understanding how the script you provided would allow me to access an action I create called Test. I'm honestly finding all of this new system very confusing though the scripting part anyway so it's probably just not making sense to me. I get the concept, like setting up actions and then writing code to act off of the action instead of a specific controller so it can be easily reconfigured, but the coding required to do something as simple as telling if a button is pressed pretty just makes it a headache.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
@@flurishart612 If you watch the OpenXR video. I show how to use it. You may need to look into some more generic Input System videos.
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew ok thx
@flurishart612
@flurishart612 3 жыл бұрын
@@VRwithAndrew I think I get what you are saying now thx. Instead of adding the testAction to your controller, you could just create a script and then declare a public InputActionReference variable named test for example, and then drag the testAction from the asset window in that, and then just do buttonPressed = test.action.ReadValue(); to read the value, or do the test.action.started or performed if you just want something to happen when the button is pressed. Sounds like you could do action.ReadValue in an update function or use action.performed from a start function in your doPerformedThing example, is one method better than the other or is there a difference I'm not understanding? thx
@rl1111rl
@rl1111rl 3 жыл бұрын
Can you do hand-tracking with this? i.e. Quest 2
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Not that I'm aware of, but maybe in the future. There are some pieces of documentation that additional input is possible. Right now it's exclusive to using OVR to my knowledge.
@rl1111rl
@rl1111rl 3 жыл бұрын
@@VRwithAndrew Thanks. I'll try again with OVR. I had difficulty getting the hands to move other rigidbodies. I added a sphere collider to each hand but the sphere appeared a meter away from the hand. Not sure where I went wrong.
@rl1111rl
@rl1111rl 3 жыл бұрын
@@VRwithAndrew Also, I think hand-tracking won't be viable for most tasks because it will never be able to handle occlusion with headset cameras alone.
@CJRH1FILMS
@CJRH1FILMS 3 жыл бұрын
Right Click > XR > "Convert Main Camera to XR Rig" ... that is my only option. What am I doing wrong?
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Double-check that you've added XR Toolkit from the Package Manager.
@tenzenin6301
@tenzenin6301 4 жыл бұрын
I need to have complex inputs, such as a different 'activation' of a selected or grabbed object for different button press events like trigger vs A vs B vs B + trigger vs A+ etc... Also, I need to have a teleport function that activates whenever you move the analogue stick forward, disabling the grab function, but I need to stop it from triggering when the grab is triggered.... I'm getting a headache with this stuff, you think you could make a video that goes into a little more detail, with some variation, and maybe even a little peek into how the scripts do their thing?
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Potentially! If I have a good example/use-case off an interactable or something benefiting from additional input. Others may find that useful.
@tenzenin6301
@tenzenin6301 4 жыл бұрын
@@VRwithAndrew for instance, in VR chat, many of the animations require multiple buttons being pressed in combination. sometimes this loads an animation, or swaps out the model of the object that hand is holding. some objects, because of their size, like a shield in a combat game, could block fast movement such as teleport. (conditional suppression of teleport) you might also want to trigger this when in combat, or in menus, etc.
@tenzenin6301
@tenzenin6301 4 жыл бұрын
sorry for the late reply, I didnt see the youtube notification somehow
@tenzenin6301
@tenzenin6301 4 жыл бұрын
oh, maybe you could make essentially a code template that would point to several of the 'actions' and change what button each action is tied to, disable and enable it, and tie it to a set named object being 'selected' or spicifically 'grabbed' or 'raycast selected' you could also show it being called by a external script to simulate game state changes.
@tenzenin6301
@tenzenin6301 4 жыл бұрын
this is not to forget showing a sampling of effects these buttons could trigger, such as changing the model or triggering a particle effect, and would be good to show an example of a custom action, looks like you can just add one in the menu using the plus button at the top, but some people might not notice that. i could become a muffin supplier next month if you did this, just to get access to the template. would make a nice video though.
@hernandonj
@hernandonj 3 жыл бұрын
Great video. Thanks!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Happy to help!
@JamesWjRose
@JamesWjRose 4 жыл бұрын
Thank you very much for this, very helpful.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
You're welcome, James!
@rodrigo.cs.machado
@rodrigo.cs.machado 4 жыл бұрын
Thank you so much man!
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
You're welcome, Rodrigo!
@marekrimal2371
@marekrimal2371 3 жыл бұрын
Briliant
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
Thanks!
@ob7633
@ob7633 3 жыл бұрын
Thank you!
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
You're welcome!
@KipppJ
@KipppJ 3 жыл бұрын
Based.
@sixsugarssixburners2318
@sixsugarssixburners2318 4 жыл бұрын
Thanks Andrew. I must be dumb, but wow for some reason I feel Unity is making everything somewhat more difficult. On one hand I feel getting input from controllers seems more straight forward and less (or zero) code, but on the other...there's something about how they're designing everything that makes it more annoying. Don't even get me started with ECS.
@KidGold17
@KidGold17 4 жыл бұрын
yea this is especially un-intuitive.
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
It's certainly not perfect. Unity is aware on how they've dropped the ball in some areas and trying to more transparent in the futre. The New Input System is very flexible and there are a lot of different ways of using it. However, the documentation is incredibly dense and it took me sometime to figure out how to do things. This is with my existing experience with Action-Based Input coming from SteamVR.
@Xzarations
@Xzarations 4 жыл бұрын
Awesome!
@VRwithAndrew
@VRwithAndrew 4 жыл бұрын
Thanks!
@Grezebhr
@Grezebhr 3 жыл бұрын
JEEZ! THANKS
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
You're welcome!
@DominiqueLavault
@DominiqueLavault 2 жыл бұрын
nice to find this info but it's already outdated... everything changed so much since the time you made that video. It's unusable now...
@DominiqueLavault
@DominiqueLavault 2 жыл бұрын
ho, sorry, just jump to kzbin.info/www/bejne/a4ulnHiPit51jbM
@HRezakhani
@HRezakhani 3 жыл бұрын
Thanks, it helps me a lot.
@VRwithAndrew
@VRwithAndrew 3 жыл бұрын
You're welcome, Hasan!
Custom Input Actions for Unity XR
18:01
VR with Andrew
Рет қаралды 46 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
How to Setup the XR Interaction Toolkit - 2023 Unity VR Basics
12:22
Fist Full of Shrimp
Рет қаралды 55 М.
Unity's NEW input system in 13 minutes
13:02
BiteMe Games
Рет қаралды 32 М.
2023 Unity VR Basics - Input System and VR Hands
11:46
Fist Full of Shrimp
Рет қаралды 32 М.
Unity XR: Button Input Setup
20:51
Ryan Kim
Рет қаралды 7 М.
Mapping Inputs to Actions in Unity VR!
7:18
Fist Full of Shrimp
Рет қаралды 6 М.
How I learned Unity without following tutorials (Developing 1)
18:11
Game Maker's Toolkit
Рет қаралды 2,1 МЛН
UNITY XR | ACTION BASED TELEPORTING!
29:09
Daniel Stringer
Рет қаралды 17 М.
How to Make a VR Game in Unity - PART 1
14:13
Valem Tutorials
Рет қаралды 695 М.
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН