Тёмный

Turn Controllers to Hands in VR with Unity XR! Part 2 

Novaborn
Подписаться 1,2 тыс.
Просмотров 7 тыс.
50% 1

Опубликовано:

 

15 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 91   
@hiabex
@hiabex 2 года назад
I'm delighted with the fact that this video is helping me solve problems that I couldn't solve elsewhere. A massive thanks to you for explaining the steps so well.
@hiabex
@hiabex 2 года назад
One more thing, the above comment was off the back of having just completed part one. In part 2 I've made it to 06:50 having typed the script for ThumbValue. A bit of a head-scratcher, the thumb doesn't animate in Play when buttons are pressed. Script and compiler show no errors, animation preview pane does have a working animation. Any suggestions ? Thanks
@ineshilz
@ineshilz 3 года назад
At first i thought it will be so much tideous work to animate the hands by myself but i ended up really enjoying it to make my own delicate hand gesture and animation :) Thank you for the good explanation and inspiration ! I couldn't follow the blend tree part unfortunately, but since i only have a grab state and an idle state, i think i just use the state mashine and a bool :) Using the float value for trigger and grip button looks really cool tho! Definitley gonna come back for this!
@theclipllama2313
@theclipllama2313 3 года назад
Amazing job on this tutorial! You made it super easy to follow. Everything is working perfectly
@Novaborn
@Novaborn 3 года назад
Glad it helped! Thanks for watching. :)
@DevDunkStudio
@DevDunkStudio 3 года назад
Nice guide! Great to see someone not immediately using the bloated Oculus Integration!
@Novaborn
@Novaborn 3 года назад
Thanks!
@DannyKuantiko
@DannyKuantiko 3 года назад
Thanks!! Really easy to follow. Please keep going. Will be nice to see how to interact with objects and simple mini-games. Thanks again, great job.
@mutelilboi171
@mutelilboi171 2 года назад
i got to the end of the left hand but it doenst move at all, and im not getting any errors telling me what to do exactly, please help
@RK-ye8zj
@RK-ye8zj 2 года назад
For anyone struggling with the Inputdevices list index out of bounds error I fixed it by putting GetInputDevice() in the update method instead. Then when the list contains something stop checking with a boolean.
@briceconraux4960
@briceconraux4960 2 года назад
Thanks, it solved my issue
@bernardmasika
@bernardmasika Год назад
hey @R K how are you stoping from checking with a boolean. thanks
@DAOXINNo15
@DAOXINNo15 Год назад
The code in the GetInputDevice() in update or put GetInputeDevice(); in the update
@RK-ye8zj
@RK-ye8zj Год назад
Bool looking = true; If(list.count !=0) looking = false
@RK-ye8zj
@RK-ye8zj Год назад
I don't remember but that should amount to the same thing no? Just keep looking in update until the list contains something
@FC12CGaming
@FC12CGaming 3 года назад
thanks for the tutorial, this really helped me
@Novaborn
@Novaborn 3 года назад
Glad it helped
@IrishWebDesign
@IrishWebDesign 2 года назад
Great tutorial. I actually got this to work! Is there a grab tutorial?
@ducks_keys8065
@ducks_keys8065 3 года назад
Hey I am unable to add the XR Hand Controller (script) to the hands to make the right hand a right hand ( not a left hand on my right hand) It doesent show a spot i can add it and it tells me to do it threw the asset post processor.
@ashleyaugspurger8492
@ashleyaugspurger8492 3 года назад
Do you have updated code? My Unity is forcing me to open in safe mode to fix multiple errors in the code, and there are outdated APIs.
@hiabex
@hiabex 2 года назад
Yes, I just got these this morning when opening the project to resume the tutorial. 'Else' being the problem. Did you find a solution? PS, I'm guessing your thumb didn't work either?
@Matty0187
@Matty0187 4 года назад
Yo these tutorials are amazing! Thank you so much for your hard work. Subscribed and hit bell for ALL videos! Do you have a discord?
@Novaborn
@Novaborn 4 года назад
Thanks! Really appreciate it. and ya I do have a discord. Novaborn#5654 if you want to add me.
@paolasagliocca7102
@paolasagliocca7102 11 месяцев назад
I get this error in the console: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index can you tell me how to solve it? thank you!
@kevinfate18
@kevinfate18 2 года назад
Hey man, great tutorials. I got a question. How do I bake lights on hands?
@FoxFigueiredo
@FoxFigueiredo 2 года назад
Amazing!
@MountainDrew-h3u
@MountainDrew-h3u Год назад
Nice tutorial. Very informational and educational...Worked great up until I tried to clone the left hand to the right. I put the cloned prefab into the model prefab for the right hand controller, rotated it to the proper orientation but it does not animate the right hand. I'm curious if the fact that I'm using the newer XR Origin (as XR Rig has been deprecated) has any bearing. I'm obviously missing something.
@MountainDrew-h3u
@MountainDrew-h3u Год назад
Ok. I got it. When I created the animation object for the left hand, I named it LeftHand. When I duplicated the prefab of the left hand and renamed it RightHand, I also changed the name of the animation object to RightHand. Unity was not very happy about that. With a few minor tweaks, everything is working perfeclty.
@DAOXINNo15
@DAOXINNo15 Год назад
So I got almost every finger to move but the thumb? I follow the steps but missing the thumb now as it just stays static
@tylerstafford7636
@tylerstafford7636 2 года назад
Everytime I try to build, it says “error building player because scripts have compile errors in the editor” I’ve tried everything people have suggested on google nothings worked :(
@AC-lt7xf
@AC-lt7xf 3 года назад
thanks for your tutorials! I am having an issue though after adding the new script and pressing play I am met with a "ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the collection"
@Cthulhu013
@Cthulhu013 3 года назад
Same.
@Joshman1412
@Joshman1412 3 года назад
@@Cthulhu013 Same
@seppedaems8335
@seppedaems8335 3 года назад
anyone fix it yet?
@bowler28
@bowler28 3 года назад
@@seppedaems8335 I too am having this issue
@seppedaems8335
@seppedaems8335 3 года назад
@@bowler28 I asked my teacher and he has fixed the issue. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR; public enum HandType { Left, Right } public class XRHandController : MonoBehaviour { public HandType handType; public float thumbMoveSpeed = 0.1f; private Animator animator; private InputDevice inputDevice; private float indexValue; private float thumbValue; private float threeFingersValue; private bool inputDeviceValid; // Start is called before the first frame update void Start() { inputDeviceValid = false; animator = GetComponent(); } // Update is called once per frame void Update() { if (!inputDeviceValid) { initInputDevice(); } AnimateHand(); } void initInputDevice() { InputDeviceCharacteristics controllerCharacteristic = InputDeviceCharacteristics.HeldInHand | InputDeviceCharacteristics.Controller; if (handType == HandType.Left) { controllerCharacteristic = controllerCharacteristic | InputDeviceCharacteristics.Left; } else { controllerCharacteristic = controllerCharacteristic | InputDeviceCharacteristics.Right; } List inputDevices = new List(); InputDevices.GetDevicesWithCharacteristics(controllerCharacteristic, inputDevices); //InputDevices.GetDevices(inputDevices); if (inputDevices != null && inputDevices.Count > 0) { inputDevice = inputDevices[0]; inputDeviceValid = true; } } void AnimateHand() { inputDevice.TryGetFeatureValue(CommonUsages.trigger, out indexValue); inputDevice.TryGetFeatureValue(CommonUsages.grip, out threeFingersValue); inputDevice.TryGetFeatureValue(CommonUsages.primaryTouch, out bool primaryTouched); inputDevice.TryGetFeatureValue(CommonUsages.secondaryTouch, out bool secondaryTouched); if (primaryTouched || secondaryTouched) { thumbValue += thumbMoveSpeed; } else { thumbValue -= thumbMoveSpeed; } thumbValue = Mathf.Clamp(thumbValue, 0, 1); animator.SetFloat("Index", indexValue); animator.SetFloat("ThreeFingers", threeFingersValue); animator.SetFloat("Thumb", thumbValue); } }
@fikon1
@fikon1 2 года назад
Hi, I'm having a problem. I copied your exact code, but my thumb doesn't want to move. I'm using an oculus quest 2 and I am on version 2020.3
@sasa-tr3hc
@sasa-tr3hc 2 года назад
thanks for such valuable tutorial, I want to ask if this is applicable for Quest 2 as well because it gives an error saying: Index was out of range. Must be non-Negative and less than the size of the collection. it gives this with this line of code: return inputDevices[0]; Please I need to fix this
@loukenart
@loukenart 3 года назад
Thank you so much!
@Novaborn
@Novaborn 3 года назад
No problem!
@okcgravity
@okcgravity 3 года назад
Hello, first time doing any of this and working with the Quest 1. I got everything coded right I think, but i am unable to get the grip button to operate the 3 fingers. I am on Version 20203.3 and have the XR controller "action Based", so not sure if that is the problem, or something weird between quest 2 and quest 1. Any advice would be appreciated.
@mrdevend633
@mrdevend633 2 года назад
Can you do a tutorial on how to grab objects with the hands
@primoscarab5771
@primoscarab5771 2 года назад
Hi thanks for the amazing tutorial. I have two problems: 1. when I press the gripbutton my thumb moves instead of the three fingers. 2. The three fingers won't move at all. Could this have something to do with my bindings? Hope you respond Edit: apparently the three fingers move when I press the primary and secondary buttons
@EGLOVEzicgo
@EGLOVEzicgo 2 года назад
Instead of flexing my fingers using the buttons on the vive controller, I want to flex my fingers with some keycode (ex:a,w,s,d) on the keyboard. I want to know how.
@mrmagit5239
@mrmagit5239 3 года назад
Hey I need some help... I got the hands working and stuff but when I use the hands to grab an object, the animation gets stuck and won’t reset. tbh I can’t figure out how to fix it
@Novaborn
@Novaborn 3 года назад
Hmmm, do you have the animation on loop? answers.unity.com/questions/204331/animation-loop.html
@leenmadiah2746
@leenmadiah2746 3 года назад
amazing!
@Matty0187
@Matty0187 3 года назад
Could you do the next tutorials on touching buttons and hand poses as an extension to this?
@Novaborn
@Novaborn 3 года назад
This is a good idea. I have a video in the pipeline already coming soon, but maybe after that one. Thanks!
@danikabanh6324
@danikabanh6324 3 года назад
Hi! I'm stuck on the XRHandController script. I copied and pasted the same exact script you used but Unity is telling me all sorts of errors like: The namespace already contains a definition for 'XRHandController' The namespace already contains a definition for 'HandType' Type 'XRHandController' already defines a member called 'Start' with the same parameter types Type 'XR HandController already defines a member called 'Update' with the same parameter types Type 'XR HandController already defines a member called 'GetInputDevice' with the same parameter types Type 'XR HandController already defines a member called 'AnimateHand' with the same parameter types I'm using version Unity 2020.2. Please help! Thanks
@Novaborn
@Novaborn 3 года назад
This sounds like you have two files named XRHandController? or maybe you copied the same thing twice in one class? The error you posted about means there is a duplicate definition got XRHandController. So check that out. Something you can do to find it if you use visual studio is highlight XRHandController and use ctrl+shift+f to search for all text like XRHandController. VS should now show you where all your XRHandControllers are.
@danikabanh6324
@danikabanh6324 3 года назад
@@Novaborn Hi I checked but I only have one file named XR HandController. I've also went over my code again and it is exactly the same as the one described in your video but I'm not sure why all these errors are popping up.
@ebrown4620
@ebrown4620 3 года назад
Great video :D I'm having a problem where I can't move the hands (they are just frozen) tho the animations seem to be all working ok.
@darklitskies
@darklitskies 3 года назад
Can these hands grab things?
@batistagc
@batistagc 3 месяца назад
This video helped me a lot. Thank u! Does anyone knows if I can apply a new material on the imported hand model?
@alexgraves8080
@alexgraves8080 3 года назад
im stuck on the XRHandController script, visual studio is not reading Animator or InputDevice as actual variables, the color is staying white instead of turning green to signify its a type of variable. i have all the required using libraries but it doesn't recognize those two as variables
@alexgraves8080
@alexgraves8080 3 года назад
i figured out its because c# isn't recognizing unity or unity.xr as things I can bring into the script, I still don't know how to fix it though
@Novaborn
@Novaborn 3 года назад
I had this problem before in an older version of Unity. I think what I did was go to Preferences -> External Tools. Then I made some changes there. Currently when I go to my settings in Unity, I have Visual Studio Community 2019 as my External Script Editor. Next I have Embedded packages and Local packages checked. If that doesn't work for you, you need to Google something like "using UnityEngine not defined in Visual Studio." Sorry if I wasn't more helpful. I do remember this being a pain to resolve for me.
@bowler28
@bowler28 Год назад
I know that it has been a year, but I'm posting this solution for other people who might read it: Run the Visual Studio installer and click modify. This will open a menu. Add the Unity 3D module by checking the little box. Relaunch Visual Studio and everything should work
@synystersocks4275
@synystersocks4275 3 года назад
awesom tutorial ^^ could you do one on grabbing objects and animation in vr?
@Novaborn
@Novaborn 3 года назад
good idea
@notjojuice
@notjojuice 3 года назад
does this work on quest 1
@Novaborn
@Novaborn 3 года назад
I only tested on Quest 2, but I am 95% sure this will also work for Quest 1
@jackbarbour1318
@jackbarbour1318 3 года назад
movement and teleportation next?
@Novaborn
@Novaborn 3 года назад
Next I'm doing a Beat Saber VR in Unity tutorial and a "game in one month" type of devlog.
@ВладиславМихалицький-ь8ц
Nice video with not working script
@tedlagaffe1545
@tedlagaffe1545 3 года назад
you move bit too fast, slow down your moves lol
@Novaborn
@Novaborn 3 года назад
thanks for the feedback
@chiaramastino9970
@chiaramastino9970 3 года назад
I have a problem: (oculus rift S: my code never enter in the IF condition so Thumb can't change value): it's like "if (primaryTouched || secondaryTouched)" is not the right one inputDevice.TryGetFeatureValue(CommonUsages.primaryTouch, out bool primaryTouched); inputDevice.TryGetFeatureValue(CommonUsages.secondaryTouch, out bool secondaryTouched); it's like it can't recognize primaryTouch or secondaryTouch (no input revealed). What could I do?
@chiaramastino9970
@chiaramastino9970 3 года назад
It was an APIs problem.
@ExtremeAwesome81010
@ExtremeAwesome81010 3 года назад
it keeps saying MissingComponentException: There is no 'Animator' attached to the "LeftHand Controller" game object, but a script is trying to access it. You probably need to add a Animator to the game object "LeftHand Controller". Or your script needs to check if the component is attached before using it. UnityEngine.Animator.SetFloat (System.String name, System.Single value) (at :0) XRHandController.AnimateHand () (at Assets/XRHandController.cs:75) XRHandController.Update () (at Assets/XRHandController.cs:34)
@bluekriptek100
@bluekriptek100 2 года назад
did you ever get this fixed because its happening to me
Далее
How to Make Physics-Based Hands in Unity XR
17:15
Просмотров 30 тыс.
Собираю Маню к осени ✨
00:48
Просмотров 626 тыс.
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 719 тыс.
Custom Input Actions for Unity XR
18:01
Просмотров 45 тыс.
UNITY TUTORIAL - VR HANDS - NEW INPUT SYSTEM
19:49
Просмотров 13 тыс.
Get Started with VR in Unity in 5 minutes!
5:38
Просмотров 8 тыс.
Building a Hand Poser for Unity XR
16:01
Просмотров 23 тыс.
I Created My Own Custom 3D Graphics Engine
26:29
Просмотров 94 тыс.
Why Solo Developers Should Use Unreal
9:51
Просмотров 398 тыс.
AI Plays Minecraft Forever (and dies)
23:22
Просмотров 411 тыс.
Quest 2 Unity Gamedev - Part 6 - Hands with VRIF
9:15