How to make a Body in VR - PART 1
Вставка
- Опубліковано 20 сер 2024
- ▶ WATCH the PART 2 : • How to make a Body in ...
▶ Get the full Project on Patreon : / valemvr
▶ Join the discord channel : / discord
Hey guys
Download Robot Kyle : assetstore.uni...
Some more info about the Animation Rigging Package :
docs.unity3d.c...
#vr #madewithunity #vrdev
definitely want a legs tutorial. never skip leg day.
I'd appreciate a leg IK tutorial, there's a serious lack of quality VR tutorials and yours are definitely quality. :)
I definitely would like the legs tutorial too! Love this, I was using FinalIK and this actually looks easier and makes more sense!
If you click on the link in his description it shows how to do the legs
For anyone having trouble with this, make sure you change your model from Generic/Humanoid to Legacy
this saved me from so much frustration. My rig kept dropping waist-deep into the ground at the start of play mode and i had no idea why. thank u
Dude, great call! Never would've guessed that! My rig also kept dropping my rig into the ground also waist-deep.
you are an absolute lifesaver I have spent like 3 hours tryna fix this
where do i find this?
smh thanks I swear "small" stuff like this is what makes half of the tutorials out there not work
This is amazing. Please make a part two as this is one of the most useful tutorials I have ever seen
Planning on making a Spiderman VR game, and this helped me in two ways: one, Teaching me how to implement IK, and two, looking at the script taught me how to track objects to the hands of the player. This should make making the web shooters MUCH easier, I just hope I can cut out the right chunk of code and not leave anything out or have anything I don't need
your games gonna be cursed and i want to play it. i like playing cursed games lol. good luck with your game
sick
It's incredible how well this turned out! Great job!
Thank you for your lovely feedback Andrew I really appreciate it. ☺️
@@ValemVR can you do this in 2018.4 because 2019.anything has a ui glitch were the inspector freezes and its not locked. And nice tutorial by the way
If you're having trouble with the body rotating 180 when you look up:
Change the ProjectOnPlane call to reference headConstraint.forward, rather than headConstraint.up. This is the whole update function:
void LateUpdate()
{
transform.position = headConstraint.position + headBodyOffset;
transform.forward = Vector3.Lerp(transform.forward, Vector3.ProjectOnPlane(headConstraint.forward, Vector3.up).normalized, Time.deltaTime * turnSmoothness);
head.Map();
leftHand.Map();
rightHand.Map();
}
Found this in a comment on Justin P Barnett's video, and it saved my life.
where do we put this.
@@MtOwlest You replace your update function with that.
Or just change the
"Vector3.ProjectOnPlane(headConstraint.up, Vector3.up).normalized, " to
"Vector3.ProjectOnPlane(headConstraint.forward, Vector3.up).normalized, "
This is amazing! I'd love to learn more on how to make a physics type game like boneworks
Part 2? Yes, please! Especially with Oculus not having foot tracking.
You're right! They do need that. I hope the oculus 3 has it.
For anyone with the problem where your character's body turns around when not looking that way or where your arms make a X, here's a fix. Make a new public transform variable under the VRRig script named mainC (for ex. public transform mainC;). This will be the the spot for our main camera. Then on your script you want to find the LateUpdate void and find the line where you wrote about the transform.forward. In this this line you want to write the following
transform.forward = Vector3.Lerp(transform.forward,
Vector3.ProjectOnPlane(mainC.forward, Vector3.up).normalized,Time.deltaTime * turnSmoothness);
This will make the body face forward using the cameras x axis and converting it to a y axis. this should fix your problem unless you look up at a 180 angle or greater. It's a pretty primitive fix but it should do the job well enough.
This is my script for EX. (Copy if you wish and if there are any more problems reply and I will try to find a fix, also if you have a better fix reply to this comment with the fix)
using UnityEngine;
[System.Serializable]
public class VRMap
{
public Transform vrTar;
public Transform rigTar;
public Vector3 trackPosOff;
public Vector3 trackRotOff;
public void Map()
{
rigTar.position = vrTar.TransformPoint(trackPosOff);
rigTar.rotation = vrTar.rotation * Quaternion.Euler(trackRotOff);
}
}
public class VRRig : MonoBehaviour
{
public float turnSmoothness;
public VRMap head;
public VRMap left;
public VRMap right;
public Transform mainC;
Vector3 headBodOff;
public Transform VrH;
private void Start()
{
headBodOff = transform.position - VrH.position;
}
private void LateUpdate()
{
transform.position = VrH.position + headBodOff;
transform.forward = Vector3.Lerp(transform.forward,
Vector3.ProjectOnPlane(mainC.forward, Vector3.up).normalized, Time.deltaTime * turnSmoothness);
head.Map();
left.Map();
right.Map();
}
}
Thanks! ily!!
Thanks, but i had a hard time understanding your variables
@@ilovemitaka yes that would make sense and i have made some improvements ill update this later
@@SwamySwank It’s fine, i figured it out. That camera front is a very good fix
Hey, could you please help me. Which object should i put to "Main C" and "Vr H" in the inspector? Is It Main C - > OVRCameraRig and Vr H -> Head Constraint? Thank you!
Edit. It did work! thank you! In this code example Vr H is the old headconstraint and the Main C is like the name says the main camera (in this case "CenterEyeAnchor")
Last week I was asking in discord and today I see this. Thank you!!!
This was a great recommendation! Thank you Jessica. 😊
At 7:05, it appears that the animation package has been updated and you'll need to check the new box in multi-parent constraint beside source objects (it reads 'sync scene values' if you hover over it). Once you do that, the head will rotate :)
i cant find that box, where is it?
Outro was great. 10/10.
For anyone who might stumble into this problem:
For the Multi-Processing Constraint, if your models head suddenly drops into the body when you click play, or if it goes up, you want to make sure you go to settings for multi-processing Constraint, and select "Position" in "Maintain Offset"
This was honestly incredible. Such a well-explained and easy-to-follow tutorial on exactly what I needed. Had some problems with the head but I tried to do an IK on that one too and the results are acceptable for what I need.
My head flew up when I tried to do the multi-parenting and for those who had the same problem, I'm sorry I don't have the solution but I think it has to do with exporting from blender.
Best ending ever!! Brilliant thank you
Ahah thank you it was so fun to record it. :D
Legitimately Read my mind. Crazy.
I would love a leg tutorial. Your content just keeps getting better!!
PLEASE DO A REALISTIC HANDS TUTORIAL! THERE ARE LITERALLY NONE ANYWHERE AND I THINK THE OVR HANDS LOOK BAD!
Amazing. I wish there were good VR tutorial channels for Unreal.
Thank you Valem for sharing this knowledge :) It's extremely kind of you. Yes a legs tutorial would be much appreciated, if you have the time. Thanks again.
would love to have the part 2! this is great
Great tutorial! definitely a part 2 would be amazing, maybe consider a part 3 showing how to add body collision with a ragdoll
I would love to see a part two of this video. Would you also do a tutorial video for how to use the oculus quest hand tracking on the hands of this tutorial
I just finished part 1 and so far you've helped me do something I couldn't manage to do or find in unreal engine for months lol you are the man I see me joining your patreon very soon sir this tutorial as is all others is very much appreciated💪🏽💯
Thanks man im glad i could help good job! 😀
Wow a whole entire one out of thousands of VR developers understands how a HUMAN NECK works!
Every single VR game has you looking inside your body when you look down because when you look down, the headset moves forward so it also moves your body forward. Like how hard is it to put a pivot point thats a few inches below the camera instead of the pivot point of the camera being your nose or something.
Well done, it's good to see some people in the development field still have common sense.
Thanks man, I was just trying to figure out how to do this!
Like the video, helped immensely on our project, would like to see the part 2 of legs IK to full fill the animations of the rest of the body.
Depsite the fact this didn't work for me and I had to follow a different tutorial, it actually solved the biggest problem I had with some other code as you can't access multidimensional arrays in the inspector but you can access an array of classes with an array of classes in it and use that instead
hey this tutorial is wonderful, the legs would be a very nice thing to learn aswell!
Can you please redo this series for Unity XR
Awesome! Thanks for these great tutorials!
Awesome! Legs/walking would be amazing, thank you!
Wow! Thanks for that series!
Great tutorial! I was wondering of doing something like this for our upcoming project! So detailed and fluid with movement in the editor. I love watching your tutorials! Wouldn't be where I am today without them!
Very nice tutorial, im just starting with unit and this one is pretty good, i didnt even knew shift+e select all, saves me much time >D TY
thank you so much i was using the fast ik fabric script for the arms for my game and this one works so much better
for those who do not know why visual studio haves "miscellaneous files" in the top right instead of "assembly-CSharp" or visual studio wont recognize certain words like "transform" and offers a replacement, try going into unity, in the top right click edit, then preferences, then external tools, and set the "External script editor" to Visual studio 2019 community" or whatever version of visual studio you are using
edit: anymore questions about this please ask, i will do my best to answer
if i wright "public Vector3 headBodyOffest;" then its giving me a yellow line do you know why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class VRMap
{
public Transform vrTarget;
public Transform rigTarget;
public Vector3 trackingPositionOffset;
public Vector3 trackingRotationOffset;
public void Map()
{
rigTarget.position = vrTarget.TransformPoint(trackingPositionOffset);
rigTarget.rotation = vrTarget.rotation * Quaternion.Euler(trackingRotationOffset);
}
}
public class VRrig : MonoBehaviour
{
public float turnSmoothness = 1;
public VRMap head;
public VRMap leftHand;
public VRMap rightHand;
public Transform headConstraint;
public Vector3 headBodyOffset;
// Start is called before the first frame update
void Start()
{
headBodyOffset = transform.position - headConstraint.position;
}
// Update is called once per frame
void FixedUpdate()
{
transform.position = headConstraint.position + headBodyOffset ;
transform.forward = Vector3.Lerp (transform.forward , Vector3.ProjectOnPlane(headConstraint.up, Vector3.up).normalized,Time.deltaTime * turnSmoothness);
head.Map();
leftHand.Map();
rightHand.Map();
}
}
Thank you, kind sir!
PART 2 YES YES YES YES !!!!!!!!!!!!!!!!!!!! PLEASE yes
This worked perfectly! Awesome!!
0:19 bros really doing the dance
Can you please show me how I can bind the the VR Rig with the steamVR Player object?
@valem I keep spinning out of control when I press play? Anyone else? Please help
Your videos are so helpful!
Thanks!
anyone knows how to move your fingers in the skeleton?
Very helpful. Thank you kindly
Incredible!!!! Waiting for legs and if you can mix grab objects in vr with this new rigging system. To show the hands doing something with this system. Thanks
Your tutorials are amazing, thank you man))) I'm also VR developer, may be beginner. I don't know so much, but I did also many interesting projects. My device is HTC Vive Pro
Great tutorial!
Is it possible to set up the legs using standard animation from mixamo for example? The IK legs in games like Arizona Sunshine look so Bad! 🤣
Thank you valem
i tried on vr vive htc and works amazing :D thank you so much !¡
I had the problem of my avatar not following my camera. Then I got that solved with playing with the rig settings for the mesh but still only the head follows, not the avatar's torso.
Later I noticed that I had accidentally put "VR Rig"-script to "Head Constraint"-gameobject. So I fixed that and put it into the parent object that is the avatar with the "Bone Renderer" and "Rig Builder"-script. This fixed my problem.
Oh and I used 2020.3 version of Unity and steamVR.
Hopefully this helps others with similar mistakes.
Great video, awesome content! Hope to see a video of slot systemXD
PLEASE DO THE LEGS AS WELL!
very helpful, thank you !
Thank you so much
My hands follow the controllers, but the head stays glued to the ground, because the main camera is also glued to the ground, which doesn't make sense because I can use the headset normally, but the game thinks that my headset is on the ground. I have the head constraints right and the main camera as the VR target in the VR Rig script, tried even using the XR Origin as the VR target for the head, which was able to make my character move with the input, but not rotate its torso let alone its head. I'm using the XR Origin because I would have to add all the components from your other tutorials over to the OVRCameraRig, and I want to avoid that.
When I tried this my character keeps flying away and my headset was not in the correct place. How to I fix this?
Just going to leave a comment here and ask for leg tutorial as well. Would really appreciate it :)
Many thanks ! It is very helpful !
How do i make this work with valve index using this or something like openxr ?
Anyone can help? i have problem on both hand (using xr rig not ovr). I put both left and right hand into vr target but when i play didn't work, only vr camera / head work. May i know what's the problem?
I've followed this tutorial three times now and it will not work. at 5:09, the hand does not follow the target object. The target just moves separately. I'm using the latest version of Unity if that makes a difference.
EDIT: Just tried it on 2019 LTS and it worked, so something about 2020.2.1f1 must be causing it to not work.
It's true. 5:09 works, but the character contorts for whatever reason. I don't understand it :(
I noticed 2020's humanoid rigging system is messed up. Switching to 2019 fixed all my problems
I manage to move it in version 2021. For some strange reasons, I just messed around with the hints and targets for both arms, it will move.
i followed this tutorial perfectly but when i load into the game on my quest i spawn outside of the body and i cant move it all i can do is rotate my head
hi ! thanks a lot for your vidéo § I just have a lotle probleme at 8:53, i dont understand can you explique me pls ? thanks !
Could you please make a video about how to add movement to the ik character?
just use the oculus integration plugin and change the rotation to pivot around the boundry i think
You are a legend sir. 🤟
Would it be possible for you to make a tutorial how to use Oculus Quest Hand Tracking in Unity (when the SDKs come out)??
Awesome tutorial -- accomplished a lot of functionality, in depth explanation, all in 15 minutes. How do you get the Unity Game View to respond to Hand Controllers? Is that in a previous video? I have a Quest, so might not be possible for me.
does anybody know how to control the fingers?
Thank you
Just tried this with SteamVR and the rigging worked nicely for the arms, but looking down rotates the entire body of my model for some reason, not just the head, so I got to stare at my own ass. All the constraints and inputs look correct, so I'm not sure why it's doing that. I'll reply or edit this comment if I figure out a solution...
More details:
- It's a gorilla model, so essentially humanoid-shaped. The hip bone of my model is the base bone, and there are a couple back/neck bones in between it and the "skull" bone. Positioning the head and neck in Blender works correctly
- Model built in Blender - it's a .blend file with no built-in animations, just an Armature and a Mesh
- The rotation of the entire model matches the rotation of my head pretty well
I got it! I just made a separate script for the skull that tracks the rotation of the camera and applies it to the skull, and removed the rotation tracking from the VR Rig
Very useful thanks! How can we add rotation on arms following hands ? Is it a way to limit rotation axis to don't have unnatural mouvement?
Can one of yall please make the script so i can copy and paste it, I think i did something wrong and it took me so long and i still cant fix it so can someone just write it for me
For some reason, whenver I select Left and Right arm IK in the hierarchy, theyre down on the ground for me, both of them, right underneath the middle of Robot Kyle. is this normal? It doesnt seem like it with my headset on..
Anyone have the issue where your rigs elbow seemingly doesn't point at the IK pole? I'm not sure why it is, but if for example, I put my right hand on my left shoulder, the right arms elbow does not point outward, rather it points inward toward the body. Any idea why this could be happening, even though I set up the IK pole properly?
I'm having a weird issue where for some reason my character's torso (using a custom character model for this) faces the opposite direction, but only in my game view. My scene view has the torso facing the correct direction, and my hand and head tracking works perfectly otherwise. Any help would be great, thanks!
this video is amazing just i wonder why when i up the head the body rotates :0
I wish there was a version of this for unreal.
Please make a part 2 with legs and trackers
thank you for this lesson . how to map avatar fingers to oculus hand fingers ?
its not working for me when I play the camera and controllers are separate from the body can anyone help
Great video! Do you know how this could work with SteamVR? Since the hands have different skeletons. Also how could you do leg tracking with Vive trackers?
have you fou found a solution?
any update?
@@cliffordeng5016 Sadly the best solution is using FinalIK or the method shown in this video extended for vive trackers
@@chris31911 Thanks I will try em out
@@cliffordeng5016 I am attempting to do leg tracking using this IK tutorial and the Steam_VR_Tracked Object script. I will connect my additional trackers for the legs to steam vr, add the Steam vr tracked object script to the ankles of the rig and then make Left and right leg IK using this tutorial.
How do you add hand poses to this?
Will you be able to show us how to close palms when touching or pressing buttons on controllers;
Full Code WORKING:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class VRMap
{
public Transform vrTarget;
public Transform rigTarget;
public Vector3 trackingPositionOffset;
public Vector3 trackingRotationOffset;
public void Map()
{
rigTarget.position = vrTarget.TransformPoint(trackingPositionOffset);
rigTarget.rotation = vrTarget.rotation * Quaternion.Euler(trackingRotationOffset);
}
}
public class VRig : MonoBehaviour
{
public float turnSmoothness = 1;
public VRMap head;
public VRMap leftHand;
public VRMap rightHand;
public Transform headConstraint;
public Vector3 headBodyOffset;
// Start is called before the first frame update
void Start()
{
headBodyOffset = transform.position - headConstraint.position;
}
// Update is called once per frame
void LateUpdate()
{
transform.position = headConstraint.position + headBodyOffset;
transform.forward = Vector3.Lerp(transform.forward, Vector3.ProjectOnPlane(headConstraint.forward, Vector3.up).normalized, Time.deltaTime * turnSmoothness);
head.Map();
leftHand.Map();
rightHand.Map();
}
}
at 8:10 I'm curious as to what if the Axis is the same for the body and head? The Y axis (green arrow) Is pointing forward for the head and body in this case.. I might have to fix my rig in blender, but I'm not sure
I know this is an older post but I had also come across this issue and was scrolling hoping to find the answer, I changed the up value for the headConstraint to forward and all worked properly!
Have you made a tutorial, how to move the fingers using the controller, e.g. for grapping unto stuff or just plain create some life into the hands?
I’ve followed your tutorial very closely but when I’m in play mode and I move my head slightly off center I just start circling around the map in crazy speeds.
Have any idea of what could cause this?
same here
Same issue. I even tried turning the weight of the head constraint off and it still start rotating like crazy and moving down.
same :'(
do you have an answer?
same :((
im having a big problem with the head it just moves way to much and when i press play it drops to the robots ankles i followed your tutoriAL BUT i couldnt find the one u was using so i used the xr manager one
When I use the multi-parent constraint and run the game, the head moves really high up for some reason (I noticed the Y value actually gets multiplied by 100.) Is there a fix for this?
it's 3 am and I figured it out-
importing from blender by default converts from blender units to unity units, with a 100 to 1 scale, that's why the head's Y coord was going up by that factor. just turn off convert units on the import setting and scale the gameobject back down
@@TheRoboticLlama is this setting found in unity or blender
@@patrickmolen523 import settings when you select the .blend or .fbx file within in unity
@@TheRoboticLlama Thank you so much from 1 year in the future lmao
would there be a way to setup an auto offset to make your arms the same length as the character?
The body doesn't follow the hands and the head at higher speeds, anyone knows how to fix it?
Any update using the new unity XR package instead of OVRRig?
Same Question! Don't seem to have the variables to input to our script.... *edit* I just went with downloading the oculus integration from the asset store.
i have follow this video correctly and applied everything on kyleRobot but only a blank screen appears on device(oculus quest 2).plz help.
The videos are great but I’m facing an issue when I follow the whole setup as described my character isn’t functional, when i use any other model it works but not proper as required like the head is not working as it suppose to be
do you know what the model is for the thumbnail?