First up, getting the grapple to be thrown nicely. When you throw something, it doesn't just travel in a straight line to its destination, it arcs towards it. This is what is known as a parabola... This is where my problems began... Three days later in a travel lodge room, I finally got it! What I needed to calculate was based on these factors. I have the start point, the target point, the distance between those points, a horizontal speed I wish it to travel, or a target time I wish it to take. This is a lot of information as well as a very specific problem to be searching for help for. After a lot of failed attempts and on the brink of giving up all hope...
http://gamedev.stackexchange.com/questions/17467/calculating-velocity-needed-to-hit-target-in-parabolic-arc
This happened. The answer!!
I converted that equation over to my script and just like that, it worked! It crazy how all your problems can be solved with one tiny equation.
Anyway, onto the next task!
Grapple climbing
The grapple climb consists of: the throw, then you get pulled towards where you grappled, when you reach your target, the climbing system takes over and you perform a normal climb. In comparison to the throw, the pulling part was easy to do, as I just needed to move the player towards the target then let the climbing system take over.
Grapple Pulling
This is when you throw the grapple, then perform a pull action which triggers a reaction on certain objects. The reaction side I'll cover in another post. The pull action itself was relatively simple howver. After the throw, and the grapple is at its target, the pull animation gets triggered which contains an event on a frame that triggers the release of the grapple from its target.
The Fiddly Bits
Amongst the whole system are the fiddly bits. By fiddly bits, I mean making the hands stay at specific points for when you are holding the rope, and making the rope stay in the hands when need be. Unity handles the actual calculations of how to place the bones in the character. You just have to figure out where you want the hands, and how much to blend between that point, and the point that the hands are in the animation (the weight). This got rather tricky, and messy because sometimes the weight needed to be controlled by animations etc. I also needed to calculate exactly where on the rope needed to be in what hand and get that to be in the palm and facing the right direction etc. None of this was particularly hard, but the sheer amount of times and places it needed to happen made it confusing.
Gloriously holding the rope. Shhh he doesn't clench his fist, I know :(
SUPERMAN! Look at him holding the rope!
Look at that reaching action! MMMMMMMMMMMM
xoxoxo



0 comments:
Post a Comment