VR Full Body Avatar | Unity Tutorial for Oculus Quest

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I'm going to show you how to rig a full body character or avatar for your VR application now this method is going to include upper body lower body and also walking animations and will work for most 3D character models so if you want to learn how to do that please stick around until the end [Music] first off we have upper body so to start off we have our basic scene with a mirror a cube and a ground we also have the OVR player controller which we got from the Oculus integration kit you'll need to install that for this project after that we just have some files that we imported and you're gonna need these files for this project it's just some animations and scripts I'll put the link for in the description first thing I want to do is go ahead and import my character into the scene I chose this random character that I found for free on the unity asset store but you can choose any character that you want I'll put the link for this one in the description as well next up we want to go to our character and we want to go to the mesh and we want to go to the objects that have the skinned mesh renderer on them and we want to select all of these and change the mesh to surround the whole body so for the first one we want to go ahead and extend that make sure that surrounds the whole body and that's going to avoid some issues in VR where the hands or parts of the body disappear to the camera so once we extend that to fit the whole body we're gonna go and make sure that it's covered from all directions and as you can see now we have it covered we're just going to go ahead and copy these bounds and then paste them for all the other objects that have the skinned mesh render on them and as you can see now they're all covered so that's going to avoid that problem and we're ready to go to the next step so after that what we want to do is rename our character to character just for simplification and then we're going to go to window package manager and install the animation rigging and this is going to help us with this project and make some parts of it simpler so now that it's done installing we're going to go to our character and add a couple of scripts the first one is going to be rig Builder and the second one is going to be bone render and then we're going to add all the bones under the transforms in the bone render script so you're going to go to your root object and then you want to select all of the bones under the root and then drag them into the transforms as you can see we have 81 bones and if we enable and disable the script then you can see that all our bones are now available on the character this is going to help us with selecting some stuff so next up we want to create a new empty object called VR constraints under our character and then we want to add a rig component to it and then add that VR constraints object under the rig layers in the rig Builder next up in the VR constraints we want to create an empty object and we want to call it right arm ik and then from there we're going to add a two bone ik constraint script to this object we're going to create another object under that called Target and another one called hint and then add the target to the Target component and the hint to the hint component on the two bone ik script then we're going to select our shoulder and then we're gonna drag that into the root and then the elbow bone and drag that into mid and then the wrist and drag that into the tip and then we're gonna go and select our Target and also select our wrist and then go animation or again get a line transform as you can see the transforms are now aligned and they're in the same location we're going to do the same for the hint but with the elbow and then drag the hint a little bit behind the elbow now that we have that we're going to duplicate this object and do the same thing for the left arm we're gonna go ahead and drag the shoulder into the root the elbow into the mid and the wrist into the tip and we're gonna also align the transforms again using the animation rigging tool and do the same thing with the elbow and the hint and pull it a bit behind the elbow so now that we have that ready we can go ahead to the next step which is creating another object under VR constraints called Head constraint and this one's going to be for the head so we're gonna add a multi-parent constraint to it and we're going to add the head constraint to the source objects and then from there we're going to select the head bone and then we're going to add that to the constrained object after that we're going to go ahead and align the transforms again as you can see now they're aligned next up we want to go to our character and we want to add one more component to it called the head body rake which is included in the folders that you get from the description and in this one we want to link the VR targets with the rig targets so we're gonna go to our Center eye anchor under OVR player controller add that as the VR Target for the head and the head constraint as the rig Target for the right hand we want to use the right hand anchor and for the rig Target it's going to be the Target under the right arm ik for the left hand it's going to be the left hand anchor and the Target under the left arm ik for the head constraint it's just going to be the head constraint and for the forward axis we want to go ahead and select our head constraint make sure that it's in local mode not Global and then once you make sure it's local we want to look at the forward access what color that is so right now it's the green one and then we're going to go ahead and select green for forward access next we want to adjust the offsets including the position rotation because it's going to be messed up initially so first of all we need to go to our OVR player controller to the camera rig and we want to disable camera rig and we also want to set the stage for the tracking origin type that way we can test in the inspector without building to the headset we are also going to disable the bone render for it to look simpler as you can see the character is a bit messed up but we're going to adjust the rotations and the positions until it looks fine so let's start with the head if we go to the rotation offset and we select negative 90 and negative 90 for Y and Z we can see that that fixes it it might not be the same for you but you just have to experiment until you see what works for your character and then we want to move the left-hand anchor or right hand anchor a little bit just so we can see the arms better and we're going to go ahead and experiment with the values that are going to give us the correct rotation of the right and left hands so if we go to our right hand and we select 90 we see that that's already enough to fix it just by putting 90 in the y-axis and then we're going to go to our left hand and also try to find the values that will fix that and like I said you're gonna have to experiment and see what values work for you and then before you stop the play mode you want to memorize these values and the reason why you want to do that is because you want to input those values before you start play mode so that every time you start your application the body parts will be in the correct rotation and also position and now you can see when we hit play that both our head and our hands are rotated by the correct amount and our Avatar looks much more normal so this should be it we now have a fully functioning upper body Avatar next up we have legs so right now as we move our character up and down we notice that the legs go through the ground so we want to add the functionality to keep the feet on the ground level and bend the knees according to the position of the character the first thing you need to do is go ahead and download some animations from miximo you can do that by creating a free Adobe account and you'll get all the animations so once you get to the website you can go and sign in and search for an animation so let's search for walking for example click on the animation you want to check in place and go to download and for the format you want to choose fbx for Unity and then just download the file as is and then after that you just import it to your project as you can see right now I have the idle animation that I'm going to use I want to go to rig and set that to humanoid and then apply and then go back to the animation Tab and change the name here to idle and check Loop time and also apply that next we want to go to our character and delete the controller in the animator tab then we're going to go to our idle animation that we imported and we're going to go to the clip that's on it and we're going to drag that onto our character and that's going to automatically create a new controller for us and if you go you can see that there's a new controller in the controller tab called character we're going to rename that to character controller and then after that what we need to do is go to our Avatar and make sure that our Avatar import setting is humanoid so you need to go and look for your avatars import settings in the folders might happens to be here and then I'm going to go to rig and make sure the animation type is humanoid and then apply lastly we want to go to our animations folder and create a new Avatar mask and we're going to call it upper body mask then we're gonna go to the humanoid section on it and then uncheck all of the upper body after that we're gonna go to our controller and then we're gonna go to the base layer settings and then we're gonna add the mask that we created which is the upper body mask to that field lastly we want to go to our character and add a new component called character legs and that comes with the scripts that you download and you want to change the offset to 0.15 or if that doesn't work you can experiment and see what works on your avatar so after that we're going to go to our animator and last thing you want to do is go to the settings and enable ik paths in the base layer we're now ready to test and we're going to check what it looks like in play mode and as you can see our knees Bend as we pull the Avatar up and down and the feet stay on ground level so now we have the legs working the last part we have is walking so to start off we want to make sure that we have all five animations for miximo idle walking walking backwards left turn and right turn and we want to go to each one of those animations and make sure that the rig on it has a humanoid animation type and then we want to hit apply and then we want to go to each one of these animations individually and make sure that Loop time is checked and also apply and then after that we're gonna go to our character and we're gonna go to our animator controller and you want to have idle as your default state and then from here we're going to create the structure for the walking animations so if you don't have idle you want to go ahead and add that and then you want to make sure it's set as the layer default state and then from there we're going to create a new blend tree and in this blend tree we're going to rename it first of all to walking and then we're going to make a transition from idle to walking and then from walking to Idol and then we want to add a parameter called is walking and type it exactly like this and then we're gonna go to our transition from idle to walking and we want to add a condition and that condition is going to be is walking is true and we want to uncheck has exit time then we want to go to our other transition and put uncheck has exit time and put is walking is false so it's going to transition from marking title when the variable is walking is false then we're going to go inside our blend tree and we want to change it to 2D simple directional and we want to add four motion fields each one for an animation so we're going to go ahead and start adding those clips in first one is walking and then second one is walking backwards and then the rest is left turn and then right turn and you want to input the values that you see on the screen for the position X and position y after that we want to go ahead and delete the blend parameter and we want to create two new float parameters X and Y and then we want to add those parameters to our blend tree next up we're going to go back to our character and we want to add one more component called Walking controller which also comes with the scripts and you can leave the values now when we go to play mode we can see that our character is animating properly when we move him side to side or from words and backwards and the last thing we have is just going to our head body rig on our character and we want to adjust the position offset for the head so the center eye anchor camera is outside of the head so nothing is blocking our view when we're looking in VR and once we find that sweet spot we want to memorize the values we can go ahead and stop play mode and then insert the values in the head body rig component and after that we're just going to go into our OVR player controller we're gonna re-enable our camera rig script that we disabled for testing and we're going to change the tracking origin type to floor level and we're now ready to go testing the headset now that we're in VR we can see the complete result and we can see that our player is animating and also tracking properly so we can apply this technique to most 3D character models if you like this video and found it useful please like And subscribe and let me know in the comments what video you'd like next thank you for watching [Music]
Info
Channel: RealaryVR
Views: 10,543
Rating: undefined out of 5
Keywords: VR, Virtual Reality, vr development, oculus quest, oculus quest 2, oculus development, realary, metaverse, metaverse development, oculus integration, oculus developer hub, Unity, Unity VR, vr tutorial, unity, vr avatar, vr character, vr body, vr full body, vr avatar tutorial, vr body tutorial, unity avatar, vr rig, vr rigging, vr character rigging, vr avatar rigging, vr legs, vr walking, vr animation tutorial, vr body tracking
Id: Iya-gKJ0V74
Channel Id: undefined
Length: 16min 14sec (974 seconds)
Published: Thu Dec 22 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.