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.
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.
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 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)
@@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.
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 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
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.
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!
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.
@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
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?
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
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.
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
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
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?
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.
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
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.
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
false! also this channel is called 1 minute unity after all not 1 hour unity if you want a throughout explanation then watch other tutorials with more than a 10 min run time *also i watch this at 0.75x/0.5x speed and i was able to do it just fine and even set a scene to use it on, your just exaggerating*
lol, waited for someone to asked that, when I was a beginner I used to always wonder the same thing... What I did is I created a folder full of basic shapes, a square, a circle a triangle, they are just png pictures that are made in Photoshop or gimp. Import the folder to unity and now you have some default shapes! Good luck with your game project mate!
Man, I don't know if it's because I didn't follow well, or if it's because I am trying to implement it into a game that already has other functionality... my first question though is what did you attach each script too?
@@brianwhite8032 A couple of things to check: 1.are you trying to grapple to the right layer? 2.the rope animation is what make this whole thing work. do the rope progression curve animation reaches the value of 1 at the last point? 3.have you added all necessary components (spring joint 2d, rigisbody2d)? 4. Youv'e said that your game has already other functionalities, is there a reason that a movement script might interapt? If you still don't find the bug, try doing exactly like I did in the video, then add to it piece by piece until you'll find what causes the problem, good luck mate.
@@1minuteunity759 Okay thank you so much. I will try again tomorrow and let you know how it goes. I appreciate your work so I hope I can get it to work :)
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
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
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
I gues I missed something but after pasting the code for Tutorial_GrapplingRope, it says "Tutorial_GrapplingRope' does not contain a definition for 'isGrappling'"
Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize; this line is showing error
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 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.
Thank you SO much!!!!
Where do I need to right click?
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.
Nice, finally a resource where I can check how a hookshot's physics should work!
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.
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?
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.
This is so sick! Thanks for the super amazing tutorial!!!
Awesome tutorial! Thnx for sharing.
Finally I found it- hook, that I need. U r the best, bro. The best
Keep going with things like this
Great tutorial bro! Helped a lot!
This looks fantastic! Can't wait to try this out
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
i was just waiting for this Subbed bro!!!!!
Thank you for making this video. Very helpful
man i love u, the best channel in this world
man, my man keeps going into the walls.. anyone know how to fix this?
Damn this guys smart. Spent half a day trying to make a grappling gun and nothing worked lol
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?
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"
If this had a wrap and unwrap on the rope when it collided with surfaces, it would be absolutely perfect!
Thank you so much for making this tutorial!!
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
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.
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)
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.
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
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
"Perfecter" is a perfectly cromulent word.
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.
Thank for the amazing tutorial for grappling hook
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 :(
*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?*
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.
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
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
@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?
i had a problem with the line not rendering, does anybody know how to fix this?
Doesn't work with me, the tutorial is too quick and the edition make it difficult to understand
Agreed
if you can't find universal render pipeline in unity 2020 you need to download from package manager
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
ty very much lifesaver
xoxo
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
you are a god.
good shit dude
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?
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
how to attach it to a Player which also has a rb and has a movement system?
Any fixes?
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!
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?
dude! Thank you!!!!!
thank you
Thanks man
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
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.
greate, i finally make a game spiderman
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
First tutorial Ive watched 0.5x speed instead of 1.5
What is the connected rigidbody for the spring arm?
I cant add the grappling hook object to the script in the inspector
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 😕
Any chance you could upload the complete project for reference?
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?
Great! :D
My launch point doesnt work how do I make it move
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.
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
am I the only one that checked to see if the video wasn't sped up?
I have a question if I want the rope to shoot straight up how do I do it plz help
camera does not have a definition for ScreenToWorldPoint??? help???
can you pls tell me how to do this in 3D?
th-cam.com/video/Xgh4v1w5DxU/w-d-xo.html
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
Does anyone know how to do this but with button inputs instead of mouse clicking
is there a way i can add WASD movement to this without breaking the physics?
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!
perfeter
hahaha it's like you read my mind.
just what i needed thanks
thanks for timely tutorial please make existing hypercasual games mechanics
okay no this tutorial is bad. and i mean it. you do things too fast and i cant even see what you're doing while watching in 0.25x
false! also this channel is called 1 minute unity after all not 1 hour unity if you want a throughout explanation then watch other tutorials with more than a 10 min run time *also i watch this at 0.75x/0.5x speed and i was able to do it just fine and even set a scene to use it on, your just exaggerating*
@@dcry1003 your opinion doesn't count! You're subscribed to 24 weeb channels
@@palvelusmusic ....fair enough
*but what weebs are we talking about right now?*
Everything works just fine but I have an issue, why can't I see the animation?
Good brother good
im new to unity and how do you have a circle sprite?
lol, waited for someone to asked that, when I was a beginner I used to always wonder the same thing...
What I did is I created a folder full of basic shapes, a square, a circle a triangle, they are just png pictures that are made in Photoshop or gimp.
Import the folder to unity and now you have some default shapes!
Good luck with your game project mate!
@@1minuteunity759 Thank You!
@@1minuteunity759 btw would it be possible if you would upload the folder onto github or googl docs?
@@yixsaw2114 I thought about it, might will, if so I'll notify everyone. Might use bitbuckets instead of GitHub.
@@1minuteunity759 ok!
sad doesn't work with active ragdolls :
Man, I don't know if it's because I didn't follow well, or if it's because I am trying to implement it into a game that already has other functionality... my first question though is what did you attach each script too?
Just added a script to the game object who has the rope, can you describe me exactly what happens?
@@1minuteunity759 The gun shows in the direction my mouse is pointing, but no function working
@@brianwhite8032 A couple of things to check:
1.are you trying to grapple to the right layer?
2.the rope animation is what make this whole thing work. do the rope progression curve animation reaches the value of 1 at the last point?
3.have you added all necessary components (spring joint 2d, rigisbody2d)?
4. Youv'e said that your game has already other functionalities, is there a reason that a movement script might interapt?
If you still don't find the bug, try doing exactly like I did in the video, then add to it piece by piece until you'll find what causes the problem, good luck mate.
@@1minuteunity759 Okay thank you so much. I will try again tomorrow and let you know how it goes. I appreciate your work so I hope I can get it to work :)
@@brianwhite8032 Awesome, stay motivated !
i didn't find the shader 1:12
i have unity version 2020.3.13
nice tutorial, but scince im new i dont have the circle as a sprite renderer. how di I get it? do I have to download something?
Create png or download one of a circle then just import it to unity
Thank you, i guess also of the square
It just keeps “grappling” the the player and does not fire anywhere. You just float in the air.
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
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
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..
i wish you can make slower and vids and more understandable but good work
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
I gues I missed something but after pasting the code for Tutorial_GrapplingRope, it says "Tutorial_GrapplingRope' does not contain a definition for 'isGrappling'"
Vector2 offset = Vector2.Perpendicular(grapplingGun.grappleDistanceVector).normalized * ropeAnimationCurve.Evaluate(delta) * waveSize;
this line is showing error
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.