🪝Grappling Gun
Last updated
Last updated
NOTE: You need a rigidbody player controller for the grappling gun to work,so just use a rigidbody player controller,or add a rigidbody component to your player controller.
First you need a Model for the grappling gun,you can use the katana I included in the asset or use your own,after that create an empty gameobject inside the main camera of the player and call it Grappling Gun Position or something like that.
There you put you Grappling Gun model and position it how you want your player to hold it.After that add an empty gameobject to your model and name it “Tip”,position it at the tip of you Grappling Gun Model where you want the hook to come out of.
After that add the “GrapplingGun” script to you model and assign every value(put the MainCamera in Camera,the “Tip” in gun tip and the Player in Player).
For the Aim Assist you can choose from what distance you want to assist your Grappling Gun and choose the object that you want to show where it will assist like a sprite or a model,etc.
You can also assign the sound when you are able to grapple.For the Debug Assist just make a sprite or a Gamobject and assign it(WARNING: THE OBJECT NEEDS TO BE IN THE SCENE) and for the sprite you can drag the “Sprite Assist” script so it always faces you camera.
Also for the Grappling Gun to rotate put the “RotateGun” script on the Grappling Gun Position and set the Grappling Gun Model position to 0 0 0 and move the actual Grappling Gun Position for it to work correctly.
After that you need to add a LineRendered component on the Grappling Gun Model and make it how you want your grappling rope to look like.
For the Rope Animation you just add the “GrapplingRope” script on the Grappling Gun Model and assign every value and make sure Quality is above 0.For it to work make sure to click on the “Affect Curve” and click on the first line that is straight and make the positions of both start point and end point of the line 0 and after that make it like a curve.An example of settings for the rope:
NOTE: FOR THE SPRITE TO ALWAYS BE VISIBLE SET IT’S LAYER TO “SPRITE”.
You can modify each value and see what results you get.