Ok I finally fixed an issue and I’ll share here: for those of you where the rope isn’t pulling the character YOU HAVE TO TYPE IN THE VALUES IN THE ANIMATION CURVE!!! right click and press edit key and on the first one put 0 in the top and 0 on the bottom and on the second put 1 in the top and 0 on the bottom I was struggling for like 2 hours
For a rookie programmer there is so much good stuff in here that's super valuable to know. I think a lot of this can be applied on more than just a Grappling Hook. This tutorial is already awesome, but If you could slow it down and take a bit more time to walk through some things it would be amazing. I had to watch this at 0.75 speed just to kind of understand what's happening.
Thank you for sharing this. You are very kind to do so :) I've spent a few hours trying to figure out how to use the line renderer for this type of animation specifically. This is a huge timesaver! Thanks for teaching me something new.
@@1minuteunity759 Hi, if I would like to fire the grappling hook and it misses, how would I go about showing that to the player? Currently it does nothing for that.
There is a common problem that I had and that I have seen in the comments that more people do, that is the player attaches to itself and nowhere else, I managed to fix it. Follow the video as he does but have in mind two things: 1- When he says the points in the animation have to be at (0,0) and (1,0) and (0,0) and (1,1) this is important, dont do it by hand, right click on the points, click on edit key and put exactly 1 or 0. 2-I think that the main problems why it attaches itself is because the first object that it finds when you click somewhere is itself, so the layers matter! On Inspector change the layer of the player (on the top right) to default and select to change the children too, and then go to grappling gun and change the layer of this one and only this one to a different layer, layer 2 works for me. This works for me with the box "grapple to all" ticked, but you can also try it if you untick the "Grapple to all" and just select grapple to the layer where the rectangles are. I would suggest you play with this until it works for you :)
i have tried what you said now my player doesn't get dragged with the grappling hook, no animation and the place from where the line goes somehow moves up. Weirdly enough this only happens on ignore raycast(second layer) layer. If i move it to another it doesn't grapple hook at all.
Ok so the code is very delicate, and if you cant get the thing to work, all you gotta do is change the launch type to Transform Launch and it worked for me.
Problems you probably have too: 1. If your rope keeps sticking to nothing, your firing point is ON the "gun barrel" and is sticking to it. 2. If the rope is not pulling your player make sure "Rope animation curve" starts at (0,0) and ends at (1,0) and try different shapes. I had to use one of the predefined shapes and then reshape it in order to work.
I understand it's like... the whole brand, but even having it on .25 speed is almost too damn fast to keep up with i have to go frame by frame to see what to do next. Good video though (so far still not done following it)
my grappling gun works but it only shoots kind of like on me i guess? i need help to fix it cuz the gun doesnt shoot to the object it shoots and sticks on me i can spin areound the pivot of the rope but it doesnt go to my platforms
Hey to those who's grappling gun won't travel at all. Here is an alternate way to SetGrapplePoint() { RaycastHit2D _hit = Physics2D.Raycast(firePoint.position, (m_camera.ScreenToWorldPoint(Input.mousePosition) - gunPivot.position).normalized, maxDistnace, _groundLayer); Debug.DrawRay(firePoint.position, ((m_camera.ScreenToWorldPoint(Input.mousePosition) - gunPivot.position).normalized * maxDistnace), Color.red, maxDistnace); if (_hit) { Debug.Log("hit"); grapplePoint = _hit.point; grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position; grappleRope.enabled = true; } } I'd recommend giving this a try if your grapple gun isn't going anywhere. Note that the Debug.DrawRay will create red line on your screen so don't be alarmed. I'm no expert but hope this can help someone.
I need alot of help with this apparently. I tried to follow as closely as I can but when I tried to grapple onto something It would connect but not pull the player. I saved and closed unity to try again later but now every time I try to grapple I get errors like "Invalid AABB a", "Invalid localAABB. Object transform is corrupt.", and "Invalid worldAABB. Object is too large or too far away from the origin." I don't know why and I don't know how to fix it.
Thank you so much you actually took feedback from us viewers. So here i ask dor another thing. Can you give a turtorial for a enemy tracking ai(like a flying enemy that goes around the environment to the player)
@1 Minute Unity can you get us a full project download? I think something is wrong with the grapping gun script, as it shoots to player himself or sticks to the background. I see many people with the same problem. I went over your tutorial 2 times, did precisely what you showed, but I always end up with the same result.
did you figure it out? its like the rope shoots toward my players head slightly then retracts back and sticks to the original firing point. its all in a split second
@@1minuteunity759 Hey, my rope doesn't travel to where i click with my mouse, it just spawns and ends at my firepoint. The rope animation is set from 0,0 to 1,1. Im not sure why this happens EDIT: "Cannot create the 2D joint on 'PLayer because it connects to itself"
@@victora203 Well that's interesting. Is what you've typed an error? Really weird my dude. Have you followed the tutorial exactly like me? or have you tried to implement your own things? hmu with an answer, currently on vacation, so I'll not be able to test things myself.
@@1minuteunity759 I'm sure i personally made a mistake. Totally understandable, enjoy your vacation. I will figure it out tomorrow. I'm just aprecciating that you want to help so much :D
@@1minuteunity759 Hey again. I tried doing the tutorial over again, and now the last problem isn't here anymore. I have some things i need to fix tho. 1. I can only see my rope if i remove my backgrounds. 2. When i launch my rope it doesn't straighten out and 3. I dont hang in my rope. I just fall infinetely. (i chose auto configure distance) Do you have any ideas on what i could check to fix this? I dont get any errors in my console.
I can get the grappling hook to shoot and latch onto an object. But it doesn't pull the player at all. I have manually entered the (0,0) (1,0) into the animation curve and launch speed curves. And I've messed with the layers and launch type. Any other ideas on how to get it working?
Thank you for this, I was struggling with the rope cuz it pushes me back when I launch it but I just had to adjust my firepoint position so it finally worked out lol
My rope is connecting to the air. What to I need to fix for it to really be launched and only connect to the objects? Is it something to do with layers? if so, what do I need to change? All my elements are with the Default Layer
Alright, *1 minute unity, please pin this.* so sharkycat109 tried to fix the issue. But he just missed one point. Let's go ahead and do it step by step! 1. First of all, once you enter the script and apply everything, just left click on the animation curve, and once you do that, right click on the beginning of that green line and click "edit key". 2. Once you click edit key, put the value (the bottom) to 0. You don't need to do anything with the above text box. And then click ENTER. Do the same with the end of the green line! Right click, click edit key and put the value to 0. 3. By the way, if your grapple isn't showing (it's invisible) then that means you didn't choose the right Material. Just play around with the types of materials you can do for example Unlit or you can also do Lit. 4. Let's get to the actual animation. Instead of right clicking on the beginning or end of the green line, just right click anywhere on the green line and click "add key" this will create some sort of point. You can drag the point to where you want it and then just add more points to create more curves in order to create the animation. 5. Well, you're basically done at this point. You actually don't need to do ANYTHING with the second animation curve because that will just straighten the line. 6. Also, go to the grappling gun and go to its script. You can choose alot of options you can play around with! For example, launch to point will, well... launch you to the point where the grappler is headed! If you turn it off, it won't let you go to the point, it will just let you hang there. That's good for swinging and stuff. If your grappler isn't letting the player rotate once it's grappled, turn ON rotate over time (I think.) Again, you can play around with the check boxes and stuff for the grappling gun script. 7. You're done!
hi, i wanted to make a game with this grappling hook that pulls the character and the other one from the old video that just swings and doesn't pull how do i do that? Could you help me, please?
it works fully for you? for some reason the rope doesnt shoot out for me it just sticks to the original area the Grappling gun is when you left click. It also doesnt work unless I check Grapple to All.
I found an Issue, the animation and all is perfect but the spring joint of my player is not currently activating whenever I want my character launch where the rope is, I´m using the Rigidbody type of launch and thats all, also thanks for this good tutorial keep going
Yes it is the firs wave is 0,0 to 1,0 and the last is 0,0 and finally 1,1, but my question is if the launch is in physics options did the Spring Joint have to like enable or something? if you have any answer please let me know, also thanks for the answer speed, if you keep doing it you will be a super indie dev channel
I've typed all the code and put all the references but when I click what I want to grapple to it doesn't do anything. It's rotating the barrel of the gun perfectly fine
Hmm. Weird. Any errors? Have you attached the spring joint, and does your player has a rigidbody? What type of launch have you selected? If you try other types of launches does it work?
The reason mine didn't work was because the start and end points of the animation were not at 0,0 and 0,1. right click and type in the number, don't move it by hand. It has to be exact.
Maybe I'm a bit too late, I solved it by editing the 64th line in Tutorial_GrapplingRope.cs script. The equality that you can see it will never be exact if you don't cast the two number with an int type (because the numbers are not integers but they are very similar to each other for example like this: 4,233 and 4,123.. thus the equation will always be false). So the code must be: if ((int)m_lineRenderer.GetPosition(percision - 1).x == (int)grapplingGun.grapplePoint.x) This worked for me. edit: it's not a perfect solution, in same rare cases it may not work.. a better solution would be this: ((int)m_lineRenderer.GetPosition(percision - 1).x - (int)grapplingGun.grapplePoint.x
Hi there, I am trying to make a grappling hook animation image, where it`s like a chain of some sort, how can I make it so that whenver it is launched that image shows instead of the line renderer. Like the scorpions hook from MK
I gues I missed something but after pasting the code for Tutorial_GrapplingRope, it says "Tutorial_GrapplingRope' does not contain a definition for 'isGrappling'"
Man, my grappling hook is thrown and it sticks to the wall, but it doesn't pull the player, can you help me? I'm br if the English is a little wrong forgive me.
Hi please help me, everything is working fine except for the fact that when I grapple, my character and the rope kind of ignores gravity. I want my rope and character when grappling to be affected by gravity, keep my current momentum and have to swing in order to get more momentum. How can I do that?
how can I set a dinamic grapple hook speed? I meen, if distance is 10 meters, I will grapple for 10 seconds, if distance is 1 meters, I will grapple 1 second
Really great tutorial and still works to this date! I have a small problem however where when I grapple into a wall about 1 in 25 times I glitch into the wall. to try and fix this I set all rigidbodys to continuos but the problem still occurs. do you know a fix?
did It really work for you? I tried it in the newest long term support 2019 version, I really did exactly what he said in a completely new gamefile. But when I shoot the rope comes out (not even from the firepoint) and then nothing happens. do you maybe know what I did wrong?
@@PhilDeveloper omg im so dumb.... had it on 1,0 and not 0,0 I thought the like straight one to select was already the correct one... thanks ! Was really confused because didnt thought that the animation can destroy everything
Yea this is not working at all. I've been at it for 2 hours and my does not come out of the gun more then a tiny little piece and I'm stuck in place. Everything is correct and sorted. I can only launch t0e player with physics launch with launch to point unchecked. The player is not going to point rather then the rope pushing the player away.
I am getting same problem as some other people, it'll only grapple a few feet and stick to background. I figured out the issue is in the SetGrapplePoint() method, something to do with Raycast most likely, as i have no idea how to use that yet. I used debug log to see that where i was clicking was not being accurately brought back to the variable 'grapplePoint'. Not sure why, but perhaps the code is overcomplicated in those lines, like its detecting obstruction's to the click point when there is none, or it's simply miscalculating the click point. Please let me know if you can fix this, because it looks great! Just has a few kinks. Like others, I'm using different sprites than you, so it's possible colliders are causing issues due to sprite sizes, but that shouldn't be it.
@@1minuteunity759 It only seems to shoot a grapple if i check the box 'grapple to all', whereas if i choose to grapple to a specific layer the line doesn't shoot out. Hmmm
@@1minuteunity759 I got it working for a second, but I'm sure it'll have issues such as now it won't grapple to specific layer or look for max distance, but luckily the RaycastHit method can use those as parameters. All i did was these 4 lines at beginning of SetGrapplePoint() Ray ray = m_camera.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.Raycast(ray.origin,ray.direction); if(hit.collider != null){ grapplePosition = hit.point; } the rest of the code is the same except i take out when you set the grappling point. This does work to connect me to only objects with a 2d collider now, as before it would shoot a fixed distance into space and attach to air.
Any tips for doing this except with the end of the rope attached to an object with a rigid body effected by gravity, and latches to whatever surface it lands on? So you could throw the rope rather then shoot it
Hey man this is a really good vid and very helpful , however the "gravity" when acc hooked to something is reallly slow and it takes ages to get back down to the middle, can you help? Its for a game jam so a reply asap would be nice
this is very strange.. at first I tried it was fine, but after I made a few changes, then downloaded until the beginning,,, the error still occurs haha, or the project accidentally became an error after a while? , maybe its because i used pentab ,yeah maybe i want to change the input ,,using onscreen joystick ,is that possible ,,, :D
The variable m_camera of Tutorial_GrapplingGun hsa not been assigned. You probably need to assign the m_camera variable of the Tutorial_GrapplingGun script in the inspector
Hey, I love your Tutorial man. It helped me a lot with my game. But I am creating a mobile game and right now you have to rotate the grappling gun to the right angle in order to shoot where u point at. That makes a lot of sense for a PC game but on mobile you would have to touch the screen once to rotate and another time to actually shoot. I tried to change parts of the script in order to kind of rotate and shoot at the same time or to even remove the FirePoint completely but it doesn't really work the way I want it to. Do you maybe know a way to achieve my plans? You seem to be extremely talented with Unity. Thank you.
Ok, so I`m following this tutorial in Unity 2020 and I keep getting funky results. The rope won`t rotate and instead of pulling the character, it actually like pushes/propels them across the screen like a rocket at just 1 angle... I tried typing the values into the Animation Curve as mentioned below, but still now dice. Anyone else experiencing this issue?
can you make a tutorial how to do like castlevania when you use the swing rope ? i tried but i dont know much coding i did follow this tutorial but it works with the mouse
Ok I finally fixed an issue and I’ll share here: for those of you where the rope isn’t pulling the character YOU HAVE TO TYPE IN THE VALUES IN THE ANIMATION CURVE!!! right click and press edit key and on the first one put 0 in the top and 0 on the bottom and on the second put 1 in the top and 0 on the bottom I was struggling for like 2 hours
Thank you so much!!!
Thank you as well.
Jeez thanks you SO much man. You saved me A LOT of time here.
Where do I need to right click?
Omg I can't believe I was going to cry after messing around for like 5 hours
You saved me or else I would have rage quit
Thank you
This isn't one minute unity.
This is 10 episodes of 1 minute unity!
Now that you clarified this video isn't going to be 1 minute long you didn't have to make the video 2x speed so I could actually understand something
Don't want to sound like a asshole, he's code helped a lot but I have no idea why he is going Mach 1
@BluMiester then he sounds super glitchy and low pitched
guys theres a playback speed for a reason
am i right? can't understand sht. he's going too fast
exactly he is way too fast
For a rookie programmer there is so much good stuff in here that's super valuable to know. I think a lot of this can be applied on more than just a Grappling Hook. This tutorial is already awesome, but If you could slow it down and take a bit more time to walk through some things it would be amazing. I had to watch this at 0.75 speed just to kind of understand what's happening.
Thank you for sharing this. You are very kind to do so :) I've spent a few hours trying to figure out how to use the line renderer for this type of animation specifically. This is a huge timesaver! Thanks for teaching me something new.
Happy to help
@@1minuteunity759 Hi, if I would like to fire the grappling hook and it misses, how would I go about showing that to the player? Currently it does nothing for that.
There is a common problem that I had and that I have seen in the comments that more people do, that is the player attaches to itself and nowhere else, I managed to fix it.
Follow the video as he does but have in mind two things:
1- When he says the points in the animation have to be at (0,0) and (1,0) and (0,0) and (1,1) this is important, dont do it by hand, right click on the points, click on edit key and put exactly 1 or 0.
2-I think that the main problems why it attaches itself is because the first object that it finds when you click somewhere is itself, so the layers matter! On Inspector change the layer of the player (on the top right) to default and select to change the children too, and then go to grappling gun and change the layer of this one and only this one to a different layer, layer 2 works for me. This works for me with the box "grapple to all" ticked, but you can also try it if you untick the "Grapple to all" and just select grapple to the layer where the rectangles are. I would suggest you play with this until it works for you :)
I've been trying to get this to work for awhile, thanks!
Edit: Just got it to work
@Matus Kordos I have the same problem, f i get it to work i will let you know
@Matus Kordos What did you do to fix it?
Yep this code is very sensitive to how layers are configured.
i have tried what you said now my player doesn't get dragged with the grappling hook, no animation and the place from where the line goes somehow moves up. Weirdly enough this only happens on ignore raycast(second layer) layer. If i move it to another it doesn't grapple hook at all.
This was useful. I am using this technique for a grappling hook which pulls ranged monsters closer to you.
That's way too fast and hard to follow and the editing is making it more dificult to watch , keep it simple
You are totally right, working on it
@@1minuteunity759 when?
Nice, finally a resource where I can check how a hookshot's physics should work!
man, my man keeps going into the walls.. anyone know how to fix this?
Ok so the code is very delicate, and if you cant get the thing to work, all you gotta do is change the launch type to Transform Launch and it worked for me.
You're amazing bro.But can you go only a bit slow?cause i am a noob and have to follow at 0.5 :D
Problems you probably have too:
1. If your rope keeps sticking to nothing, your firing point is ON the "gun barrel" and is sticking to it.
2. If the rope is not pulling your player make sure "Rope animation curve" starts at (0,0) and ends at (1,0) and try different shapes. I had to use one of the predefined shapes and then reshape it in order to work.
where should the firing point be?
I understand it's like... the whole brand, but even having it on .25 speed is almost too damn fast to keep up with i have to go frame by frame to see what to do next. Good video though (so far still not done following it)
my grappling gun works but it only shoots kind of like on me i guess? i need help to fix it cuz the gun doesnt shoot to the object it shoots and sticks on me i can spin areound the pivot of the rope but it doesnt go to my platforms
same, i need help on this too
same :(
Hey to those who's grappling gun won't travel at all.
Here is an alternate way to SetGrapplePoint() {
RaycastHit2D _hit = Physics2D.Raycast(firePoint.position, (m_camera.ScreenToWorldPoint(Input.mousePosition) - gunPivot.position).normalized, maxDistnace, _groundLayer);
Debug.DrawRay(firePoint.position, ((m_camera.ScreenToWorldPoint(Input.mousePosition) - gunPivot.position).normalized * maxDistnace), Color.red, maxDistnace);
if (_hit)
{
Debug.Log("hit");
grapplePoint = _hit.point;
grappleDistanceVector = grapplePoint - (Vector2)gunPivot.position;
grappleRope.enabled = true;
}
}
I'd recommend giving this a try if your grapple gun isn't going anywhere. Note that the Debug.DrawRay will create red line on your screen so don't be alarmed.
I'm no expert but hope this can help someone.
YOU ARE A LIFE SAVER!!!
where did you get _groundLayer from? Im getting an error because of it
You freaking Ledge!! thanks pal!
@@solomonlyons10 If this is still a problem, just change it to the "grappableLayerNumber"
i had a problem with the line not rendering, does anybody know how to fix this?
Awesome tutorial! Thnx for sharing.
This is so sick! Thanks for the super amazing tutorial!!!
Finally I found it- hook, that I need. U r the best, bro. The best
you have to watch the video at 0.75 speed to understand
Damn this guys smart. Spent half a day trying to make a grappling gun and nothing worked lol
I need alot of help with this apparently. I tried to follow as closely as I can but when I tried to grapple onto something It would connect but not pull the player. I saved and closed unity to try again later but now every time I try to grapple I get errors like "Invalid AABB a", "Invalid localAABB. Object transform is corrupt.", and "Invalid worldAABB. Object is too large or too far away from the origin." I don't know why and I don't know how to fix it.
Thank you so much you actually took feedback from us viewers. So here i ask dor another thing. Can you give a turtorial for a enemy tracking ai(like a flying enemy that goes around the environment to the player)
I just realized you dont even have 1k subs. Bruh your videos are so good
Next video is AI themed... Don't tell anyone (Well, not about flying things but be sure it will be cool😎)
@@1minuteunity759 yayyyyy
please. just for the love of everything SLOW THE FFFFF DOWN!!!!!!!!!
yeah :(
i had to watch it at 0.75 speed
@@elliotrudkin4853 sometimes i pulled it down to 0.25 to understand what he was doing ;-;
@@elliotrudkin4853 I had to watch at 0.5 speed 😂
better than stay 30 minutes for information that can be said in 1 minute
If this had a wrap and unwrap on the rope when it collided with surfaces, it would be absolutely perfect!
Does anyone know how to do this but with button inputs instead of mouse clicking
Keep going with things like this
I did it but the rope doesn’t leave the grappling gun.it is just stuck in the gun or is a dot on the screen.
did you figure it out? i have the same problem
@1 Minute Unity can you get us a full project download? I think something is wrong with the grapping gun script, as it shoots to player himself or sticks to the background. I see many people with the same problem. I went over your tutorial 2 times, did precisely what you showed, but I always end up with the same result.
did you figure it out? its like the rope shoots toward my players head slightly then retracts back and sticks to the original firing point. its all in a split second
@@TornSilencio Nah, sadly was not able to. I abandoned the project after trying hard. Couldnt figure it out :/
@@JRebYT its ok thank you! I'm really disappointed in this tutorial...been trying to figure out whats wrong for almost a week now
@@JRebYT *update omfg I think I figured it out...it pulls in really fast which i need to fix but its actually working.
@@TornSilencio how did you fix it?
PERFECT VIDEO! Tysm for giving code and not wasting anyones time with bs. You got a new subscriber🔥🔥👍🏾
Learning to code is never a waste of time if you want to achieve greatness.
how to attach it to a Player which also has a rb and has a movement system?
Any fixes?
how do I detect if i grappled a left wall, a right wall, a floor, or a ceiling
You have waaaaaaay too little subs man. This is CONTENT. I hope you grow soon!
Thanks man, really appreciate it!
@@1minuteunity759 Hey, my rope doesn't travel to where i click with my mouse, it just spawns and ends at my firepoint. The rope animation is set from 0,0 to 1,1. Im not sure why this happens
EDIT: "Cannot create the 2D joint on 'PLayer because it connects to itself"
@@victora203 Well that's interesting. Is what you've typed an error?
Really weird my dude.
Have you followed the tutorial exactly like me? or have you tried to implement your own things?
hmu with an answer, currently on vacation, so I'll not be able to test things myself.
@@1minuteunity759 I'm sure i personally made a mistake. Totally understandable, enjoy your vacation. I will figure it out tomorrow. I'm just aprecciating that you want to help so much :D
@@1minuteunity759 Hey again. I tried doing the tutorial over again, and now the last problem isn't here anymore. I have some things i need to fix tho. 1. I can only see my rope if i remove my backgrounds. 2. When i launch my rope it doesn't straighten out and 3. I dont hang in my rope. I just fall infinetely. (i chose auto configure distance)
Do you have any ideas on what i could check to fix this? I dont get any errors in my console.
I can get the grappling hook to shoot and latch onto an object. But it doesn't pull the player at all. I have manually entered the (0,0) (1,0) into the animation curve and launch speed curves. And I've messed with the layers and launch type. Any other ideas on how to get it working?
If the auto configure distance is turned on on the springJoint2d the physics launch won't work. That turned out to be my issue
Thank you for this, I was struggling with the rope cuz it pushes me back when I launch it but I just had to adjust my firepoint position so it finally worked out lol
I have a question if I want the rope to shoot straight up how do I do it plz help
My rope is connecting to the air. What to I need to fix for it to really be launched and only connect to the objects? Is it something to do with layers? if so, what do I need to change? All my elements are with the Default Layer
Great tutorial bro! Helped a lot!
This looks fantastic! Can't wait to try this out
I cant add the grappling hook object to the script in the inspector
if you can't find universal render pipeline in unity 2020 you need to download from package manager
Alright, *1 minute unity, please pin this.* so sharkycat109 tried to fix the issue. But he just missed one point. Let's go ahead and do it step by step!
1. First of all, once you enter the script and apply everything, just left click on the animation curve, and once you do that, right click on the beginning of that green line and click "edit key".
2. Once you click edit key, put the value (the bottom) to 0. You don't need to do anything with the above text box. And then click ENTER. Do the same with the end of the green line! Right click, click edit key and put the value to 0.
3. By the way, if your grapple isn't showing (it's invisible) then that means you didn't choose the right Material. Just play around with the types of materials you can do for example Unlit or you can also do Lit.
4. Let's get to the actual animation. Instead of right clicking on the beginning or end of the green line, just right click anywhere on the green line and click "add key" this will create some sort of point. You can drag the point to where you want it and then just add more points to create more curves in order to create the animation.
5. Well, you're basically done at this point. You actually don't need to do ANYTHING with the second animation curve because that will just straighten the line.
6. Also, go to the grappling gun and go to its script. You can choose alot of options you can play around with! For example, launch to point will, well... launch you to the point where the grappler is headed! If you turn it off, it won't let you go to the point, it will just let you hang there. That's good for swinging and stuff. If your grappler isn't letting the player rotate once it's grappled, turn ON rotate over time (I think.) Again, you can play around with the check boxes and stuff for the grappling gun script.
7. You're done!
sorry i didnt get it where should i click a sorry but im beginer
What is the connected rigidbody for the spring arm?
Thank you for making this video. Very helpful
*AMAZING and i am planning to use this in my commercial game, so should i credit you or you know, at least can i even use it?*
hi, i wanted to make a game with this grappling hook that pulls the character and the other one from the old video that just swings and doesn't pull how do i do that? Could you help me, please?
I speed up every tutorial I watch by x2 speed at least.
Jesus christ I've never had to slow down someone before lol.
i was just waiting for this Subbed bro!!!!!
I've got everything else working, but if I turn off grapple to all, it doesn't fire at all, no matter what layer number I enter
i have the same issue...did you figure it out?
My launch point doesnt work how do I make it move
man i love u, the best channel in this world
is there a way i can add WASD movement to this without breaking the physics?
Thank you so much for making this tutorial!!
Dude ure legend, imo you should put this to store as a slap of faces of some putting plugin with 5 bucks
it works fully for you? for some reason the rope doesnt shoot out for me it just sticks to the original area the Grappling gun is when you left click. It also doesnt work unless I check Grapple to All.
Hey, awesome tut, any advice on how to add a little 2d hook sprite on the end of the rope?
I want to do the same, you find finally could make It?
Can you do how to make grapple points so like certain spots in ur map that you can grapple?
He had a layer thing in the line script
Add the things u want to be grappable to the layer!
You think you could do a video on how to reverse the animation of the rope to go back into the gun when you let go of the mouse? Great vid btw
camera does not have a definition for ScreenToWorldPoint??? help???
I found an Issue, the animation and all is perfect but the spring joint of my player is not currently activating whenever I want my character launch where the rope is, I´m using the Rigidbody type of launch and thats all, also thanks for this good tutorial keep going
Is the last value of the rope progression curve at exactly (1,1)?
Yes it is the firs wave is 0,0 to 1,0 and the last is 0,0 and finally 1,1, but my question is if the launch is in physics options did the Spring Joint have to like enable or something? if you have any answer please let me know, also thanks for the answer speed, if you keep doing it you will be a super indie dev channel
For some reason the grappling isn't working and I fall through the terrain 😕
I've typed all the code and put all the references but when I click what I want to grapple to it doesn't do anything. It's rotating the barrel of the gun perfectly fine
Doesn't work with me, the tutorial is too quick and the edition make it difficult to understand
Agreed
How do you not have more subs, the unsolved mystery of youtube...
He's good but his channel only had few videos, That's the reason for fewer subs.
Any chance you could upload the complete project for reference?
The grapple latches to the location but won’t pull the character at all. Any solutions?
Hmm. Weird.
Any errors?
Have you attached the spring joint, and does your player has a rigidbody?
What type of launch have you selected? If you try other types of launches does it work?
@@1minuteunity759 Same problem, nothing seems to fix it
The reason mine didn't work was because the start and end points of the animation were not at 0,0 and 0,1. right click and type in the number, don't move it by hand. It has to be exact.
Maybe I'm a bit too late, I solved it by editing the 64th line in Tutorial_GrapplingRope.cs script.
The equality that you can see it will never be exact if you don't cast the two number with an int type (because the numbers are not integers but they are very similar to each other for example like this: 4,233 and 4,123.. thus the equation will always be false).
So the code must be:
if ((int)m_lineRenderer.GetPosition(percision - 1).x == (int)grapplingGun.grapplePoint.x)
This worked for me.
edit: it's not a perfect solution, in same rare cases it may not work.. a better solution would be this: ((int)m_lineRenderer.GetPosition(percision - 1).x - (int)grapplingGun.grapplePoint.x
@@likyepetti thank you so much
hey i need some help whenever i create a URP Particles Lit texture like you did in the tutorial my texture is just the missing texture one..
mine does not shoot to the mouse position! any idea one what could fix this?
Hi there, I am trying to make a grappling hook animation image, where it`s like a chain of some sort, how can I make it so that whenver it is launched that image shows instead of the line renderer. Like the scorpions hook from MK
I gues I missed something but after pasting the code for Tutorial_GrapplingRope, it says "Tutorial_GrapplingRope' does not contain a definition for 'isGrappling'"
Man, my grappling hook is thrown and it sticks to the wall, but it doesn't pull the player, can you help me? I'm br if the English is a little wrong forgive me.
Did you ever find a solution? I'm having the same problem
@@garrettbates9124 No, man.
nothing came out of my firepoint thingy no rope no nothing and i don't really know why i setted up everything
Everything works just fine but I have an issue, why can't I see the animation?
when I try using the grappling gun it just hooks me to where my player is standing
how can I fix it !!??
can you pls tell me how to do this in 3D?
th-cam.com/video/Xgh4v1w5DxU/w-d-xo.html
Hi please help me, everything is working fine except for the fact that when I grapple, my character and the rope kind of ignores gravity. I want my rope and character when grappling to be affected by gravity, keep my current momentum and have to swing in order to get more momentum. How can I do that?
Update: it is affected by gravity but very slowly sinks down and the rope feels very rigid and like it slightly defies gravity
tried everything 0,0 0,1 layers not working gun is pointing to mouse pos but no string fired ;{
i have 1 issue: rope shoots but player doesnt move, what can i do about that?
Does he have a discord server.I tried to change the code for controllers as find the grapple point automatically but that does not work.
how can I set a dinamic grapple hook speed? I meen, if distance is 10 meters, I will grapple for 10 seconds, if distance is 1 meters, I will grapple 1 second
Really great tutorial and still works to this date! I have a small problem however where when I grapple into a wall about 1 in 25 times I glitch into the wall. to try and fix this I set all rigidbodys to continuos but the problem still occurs. do you know a fix?
did It really work for you? I tried it in the newest long term support 2019 version, I really did exactly what he said in a completely new gamefile. But when I shoot the rope comes out (not even from the firepoint) and then nothing happens. do you maybe know what I did wrong?
@@blekcode1416 make sure the animation graph starts at exactly 0 and ends at exactly 1
@@PhilDeveloper omg im so dumb.... had it on 1,0 and not 0,0 I thought the like straight one to select was already the correct one... thanks ! Was really confused because didnt thought that the animation can destroy everything
What do you attach the spring joint 2d to, console keeps throwing errors saying that my spring join is attached to itself!
Yea this is not working at all. I've been at it for 2 hours and my does not come out of the gun more then a tiny little piece and I'm stuck in place. Everything is correct and sorted. I can only launch t0e player with physics launch with launch to point unchecked. The player is not going to point rather then the rope pushing the player away.
sorry to hear that,
You can clone the project from github if you want and compare on what's happening
@@1minuteunity759 how do I clone the project
@@kuokkamdamha1691 I pinned the link to the GitHub, fro there to can clone it
@@1minuteunity759 i have seen the link but I don't know how to clone it
Right now my grappling gun is only repelling me backwards how would i fix that??
"Perfecter" is a perfectly cromulent word.
Thank for the amazing tutorial for grappling hook
How would I make it to where the raycast would ignore a layer? If you could respond to this ASAP that would be appreciated
I am getting same problem as some other people, it'll only grapple a few feet and stick to background. I figured out the issue is in the SetGrapplePoint() method, something to do with Raycast most likely, as i have no idea how to use that yet. I used debug log to see that where i was clicking was not being accurately brought back to the variable 'grapplePoint'. Not sure why, but perhaps the code is overcomplicated in those lines, like its detecting obstruction's to the click point when there is none, or it's simply miscalculating the click point. Please let me know if you can fix this, because it looks great! Just has a few kinks. Like others, I'm using different sprites than you, so it's possible colliders are causing issues due to sprite sizes, but that shouldn't be it.
What layer are you trying to grapple to?
@@1minuteunity759 It only seems to shoot a grapple if i check the box 'grapple to all', whereas if i choose to grapple to a specific layer the line doesn't shoot out. Hmmm
@@1minuteunity759 I got it working for a second, but I'm sure it'll have issues such as now it won't grapple to specific layer or look for max distance, but luckily the RaycastHit method can use those as parameters. All i did was these 4 lines at beginning of SetGrapplePoint()
Ray ray = m_camera.ScreenPointToRay(Input.mousePosition);
RaycastHit2D hit = Physics2D.Raycast(ray.origin,ray.direction);
if(hit.collider != null){
grapplePosition = hit.point;
}
the rest of the code is the same except i take out when you set the grappling point. This does work to connect me to only objects with a 2d collider now, as before it would shoot a fixed distance into space and attach to air.
@@Calico983 hey did you find a solution? If so could you please tell me, I’m also stuck at this exact same problem
make sure you move the fire point transform from 0,0,0 otherwise it just sticks to the player. Mines set to 0.1, 0,0 and works fine
doesnt work for me the hook is just chilling above the character and wont move with my mouse idk
i didn't find the shader 1:12
i have unity version 2020.3.13
Any tips for doing this except with the end of the rope attached to an object with a rigid body effected by gravity, and latches to whatever surface it lands on? So you could throw the rope rather then shoot it
Hey man this is a really good vid and very helpful , however the "gravity" when acc hooked to something is reallly slow and it takes ages to get back down to the middle, can you help? Its for a game jam so a reply asap would be nice
LIke for the auto configure distance it doesnt fall or move towards underneath the grapple point, it just kind of floats there
this is very strange.. at first I tried it was fine, but after I made a few changes, then downloaded until the beginning,,, the error still occurs haha, or the project accidentally became an error after a while? , maybe its because i used pentab ,yeah maybe
i want to change the input ,,using onscreen joystick ,is that possible ,,, :D
The variable m_camera of Tutorial_GrapplingGun hsa not been assigned. You probably need to assign the m_camera variable of the Tutorial_GrapplingGun script in the inspector
Literally what you need to do. Go to the inspector, and assign the camera to the script. If you are having more problems let me know. Good luck!
I did and still the same thing when i start the game in can move gun pivot direction but i cant see the player and i cant shoot
@@عمرالشهري-ب3خ change the layer arrangement so the player and the rope are on top
I still cant get the player to lunge forward when grappling?
Any suggestions??
It just keeps “grappling” the the player and does not fire anywhere. You just float in the air.
Hey, I love your Tutorial man. It helped me a lot with my game. But I am creating a mobile game and right now you have to rotate the grappling gun to the right angle in order to shoot where u point at. That makes a lot of sense for a PC game but on mobile you would have to touch the screen once to rotate and another time to actually shoot. I tried to change parts of the script in order to kind of rotate and shoot at the same time or to even remove the FirePoint completely but it doesn't really work the way I want it to. Do you maybe know a way to achieve my plans? You seem to be extremely talented with Unity. Thank you.
Ok, so I`m following this tutorial in Unity 2020 and I keep getting funky results. The rope won`t rotate and instead of pulling the character, it actually like pushes/propels them across the screen like a rocket at just 1 angle... I tried typing the values into the Animation Curve as mentioned below, but still now dice. Anyone else experiencing this issue?
Were you able to figure it out? My rope keeps spitting out but only a tiny bit and off to the side, doesn't hook onto anything too
Same, I'm using 2021
can you make a tutorial how to do like castlevania when you use the swing rope ? i tried but i dont know much coding i did follow this tutorial but it works with the mouse
What do I have to add to the code to attract objects to the player with the hook?
I think I did it right, but why does the hook sometimes go out and sometimes not?