VR Physics hands, the right way.
<h1><strong>Intro/Preamble</strong></h1>
<p>Throughout my time spent learning how to do virtual reality (VR) physics, I’ve seen a couple of examples thrown around about how to make your hands physically interact with the world. By physically interact, I mean when you move your hand or controller from one place to another, if there is something in the way in the virtual world, it should stop. Sounds simple enough right?</p>
<p>Unfortunately I have spent a large many months trying various ways of solving this problem. From SteamVR’s weird Unity integration, to setting the velocity of the hand every frame, everything I’ve seen is just weird. Recently I have been seeing PD controllers being used to solve this problem, which is a great way to go about it. The problem with them is that there are lot of edge cases, can get very complex very quickly, and there is not a large amount of documentation online regarding how to properly use them in a game engine. The tutorials that try to explain them do not understand the math they are showcasing, they do not understand how to keep it simple.</p>
<p>Instead of all of this, we are going to use something that is somewhat engine agnostic, and relatively simple to wrap your head around, a joint. In game physics, joints are used as constraints between two bodies. For example, let’s say I have two objects I want to weld together, and have them act as one. I would use a joint for this, and lock any motion away. Joints can also be used to have objects repel each other, track each other and more.</p>
<p>This guide uses Unity’s configurable joint and a script, with the goal of keeping your hands as tight to the controller as possible. These hands will also apply inversely to the user’s body, for example, if I push down on a surface, my body will move up.</p>
<p><a href="https://medium.com/@alecpizz/vr-physics-hands-the-right-way-4846ec1eae71"><strong>Click Here</strong></a></p>