Next up on the grapple check list is the actual throwing. At first I simply made the hook snap to the point. This was to get things started and test the detection system.
The grapple system consists of: A collider, a script, a spherecast (think a fat raycast) and some checks. The spherecast gets fired from the cameras position to the center of the screen (or the equivilant direction in world space). If it hits a grapple collider, it checks the script attached to it, the script tells it what type of grapple action it is. If it is a grapple climb (the image above) then a grapple point is calculated. The point for a grapple climb, is on the top edge above where the spherecast hit. The point for a grapple pull is always the top center of the collider. The green line represents the spherecast, the pink line is the hit point, the blue line is from the calculated grapple point up. Before the ok is given to say that the point is valid, checks take place to ensure that this will be a valid throw. These include distance checks and collision tests to ensure its a clear path and you're at a distance where the grapple would reach!
oxoxoxo

0 comments:
Post a Comment