Completing the gameplay is the grapple pull. This, as the name might suggest, is the player pulling the grapple after throwing it. It is near exactly the same as the grapple climb but the returned "grapple point" is always at the top center of the front face of the box collider:
Imagine if the black box is the front face of a box collider. If the purple dots are all different raycast hit points, the returned point is always the bottom of the blue line. I chose to do it this way as the grapple pull point are small targets and by ensuring the point to be the bottom of the blue line, you can make the hook line up with other
Like so!!
So next up is the action after you pull. How to go about that. I thought of it like this. The guy who draws the lottery numbers out each week doesn't then go around to every person who bought a ticket's house to check if they won or not. The people who bought the tickets check the numbers. The same with the grapple system. The grapple doesnt go around and ask each point if they are the one it hit. The points themselves individually check to see if the grapple hit them, if it did, perform the required action.
In our case, every one of the grapple pulls triggers an animation, and usually a particle effect. So, I made a script that you give an animation and optionally a particle effect. You attach it to your desired object and assign these parameters and also the grapple point collide itself. THen the sctipt will detect when that point has been grappled and will trigger the event. The grapple collider is then destroyed.
The example above is for a more specific action, the pull over of the lion statue. This one required some more options to turn on and off collisions at points in the animation. The simpler, no object specific one only takes an animation and the grapple point at the moment. I need to finish it off but I'm not sure if ill have time to.

0 comments:
Post a Comment