# Dev Diary 2: Climbing in Mystic Hands 2.0 Mystic Hands 2.0 is out! And it contains a long-requested feature: CLIMBING! ![Climbing](https://imgur.com/a5OTC3k.gif) So: how does it work? Climbing was something that I initially thought would be really tricky to implement. Back when I was first making Mystic Hands, it was something I knew would be awesome and that everyone would want, but I always felt it was just gonna be too hard. Turns out: It's not! And especially with some of the changes in U10. ## Joints? What are they? Joints are a powerful physics tool in the Unity game engine (on which B&S is built). They connect two objects together in a highly configurable way, from doors that swing on their hinges to grappling hooks to the motion of the shards of the Shatterblade. Mystic Hands already uses a bunch of joints: * A joint is what moves each hand to its target point * A joint controls the rotation of each hand * A joint is created between the hand and items/creatures that you grab Joints can get complicated pretty quickly, so suffice it to say that in Mystic Hands they are used to **move two things together**, and **move objects towards points in space**. In B&S you usually don't want to directly move things. If you tell an object to go somewhere, it will essentially teleport to that spot - it doesn't care what's in the way, or what is currently at the place you specify. So usually, you tell things to move with physics - by adding force, or by creating a joint between the object and the point you want it to be. ## How the heck do we even move the player? Locomotion (the technical term for movement) in VR is pretty tricky to pull off - but luckily, the system used in B&S got a lot simpler with the release of U10. Every `Creature` in Blade and Sorcery (the player, the chicken, and all the NPCs) has a `Locomotion` controller attached to it. This controller has a capsule-shaped (pill-shaped) collider, which is what makes sure you don't fall through the ground. To move the player, we add force to locomotion controller. But, because the player is physics-controlled and enabled, we can also use joints to link them to objects or pull them to points in space! ## Figuring out where everything wants to go The Mystic Hands use an exponential calculation to figure out where they want to go. It uses the position the hands are relative to the player's chest, and multiplies that exponentially to find the target position. To put it in terms of vector math, the spell looks at the vector between the player's chest and the player's hand, and multiplies it by around 7 - plus a bit of exponential growth. That position is the target position of the hand, and a joint is created and updated such that it is always pulling the hand towards that point. ## Climbing! Climbing is a bit more complicated: ![](https://i.imgur.com/KUcEqJx.png) First, the spell gets the vector between the _current_ position of the hand and the _target_ position of the hand, as calculated above. This is the distance and direction the hand would need to move to reach its target position. It can then create a joint between the player and a point in space equal to the player's position plus that vector. You can think of it like a joint that tries to move the player in the opposite direction that the hand is trying to move - moving the target position to the hand by moving the player, as opposed to moving the hand to its target position. So - I hope you enjoy the mod! It's been a long time in the making.