How can I make my grapple hook more restrictive on my movement/Limit my movement?

Hello!

I’m currently working on a climbing system, And for this system, it’ll be heavily inspired by White Knuckles climbing.

And if you haven’t played white knuckles, I’ll explain the climbing system:

==How the system should work==

So, You have to point your crosshair on an obstacle and then click and hold your mouse button (Mouse button depends on your hand) to attach yourself to the obstacle. And when you attach yourself you can still swing yourself and move a tiny bit, Kinda like a short tether that attaches you to the point your “Holding“ (That will be important for my problem later)

And to detach yourself you release your mouse button.

==On to what my issues/confusion==

And so since the system is just basically yourself being attached to a wall and being able to swing around. Basically, an invisible short tether system, I decided to look for tutorials on how I could achieve this/Grapple hook tutorials. This one in specific if you’re looking for it: How to Make a Grappling Hook in Unreal Engine 5 - Very Easy - YouTube. (This is the only one I could find that’s basically what I’m looking for)

And I followed this tutorial and I did create the tether and it’s as I expected. But the issue is, that It has no limitations on movements, I can basically move so far that it it’s basically you holding onto an invisible limitless rope, which is an issue when you’re supposed to be climbing not holding an invisible rope on a wall.

I don’t really know how to solve this, I’ve tried doing different methods like “Move Actor To“ (It flickered my player and sometimes glitched it entirely) and ect.

This is the code of grabbing and the force:

In short, I have a climbing system based on a short tether, but that short tether’s length has no limit, and I don’t really know how to set up the tether limit

If anyone has any suggestions or any other ideas for my problem, please don’t be afraid to say!

I understood what you don’t like but you never say how you want it to behave.

If you just want to do “nothing” (not to attach) then just input max tether length in the LineTrace distance in place of the “100”


(yes this is your screen capture and yes it is at that resolution :wink: )

If you still want some animation when you can’t connect just put it on the branch where the “NO” is.

Oh my, no wonder the line was so wrong… You’re right the line trace multiplier was too long.
I didn’t even notice that. My bad lol. Thank you! T-T

That solves one of my issues, but I’m still having another issue of whenever I look at something that isn’t the thing I’m climbing on, While I’m climbing. For example: At the sky, behind me or ground behind me while climbing, Ect. It thrusts me towards wherever I’m looking at, and somehow extends my line, While still being gripped onto the last place I latched to. and I don’t know how to solve that lol.

And Idk if this is a separate issue but I can still use my W,A,S,D’s and that moves me back and extends the tether

Also I didn’t mention how I wanted it to behave. That’s my bad truly.

I want the player to be able to click on any surface and latch onto it with the grip/tether. And be able to pull themselves up or down with W or S (which already works from what I see). And also be able to look behind or anywhere while still being gripped, but also stop gripping when you release your mouse and fall.

Your second problem is here:

You are adding a force towards wherever the camera is pointing so if the camera is pointing backwards… well you go backwards because its multiplier is quite large.

I am not sure what the other force is supposed to be. You get the the normalized vector to the anchor point (reversed) but then you multiply it by the dot product with the velocity?… Is this supposed to be some kind of projection? (note that non of the vectors is normalized so the dot product will be |velocity| * |tether| * cos(angle) )

About the behavior definition… You need to be more deliberate with your design.

“…pull themselves up or down with W or S…” Doesn’t “pulling themselves down” mean that S will “move you back and extends the tether” as described.

What should A and D do while hanging on the line? What about if you are attached but still on the ground? What about if you anchor to a lower point like if you are on the edge of a canyon and attach at a lower point on the opposite wall so the tether pulls you down to the ground?
Wat happens if you just anchor and don’t push any button - not W, not S - will you stay on the same position? What about just pushing A and D while anchored? At what point is the tether removed and the link broken?

Would you say I’d need to reduce the Forward Vector Multiplier Or just remove the “Forward Vector Add Force” Entirely?

I’m not quite sure about the normalize vector, I don’t quite know much about stuff like that. I just sorta kinda of followed the tutorial…
I esentially know basically everything in visual programming, except for most of the math nodes, Except the basics like “>”, “<”, “>=”, “<=”, “==”, Just basically the subsurface understandable math notes Ect. (I’m self taught and most of my projects I’ve done haven’t required as much complex mathematics nodes such as this.) So I don’t really know the normalize vector or how I could fix this if its wrong

Also My bad I should’ve been more specific on what I meant with the behavior:

W = Moving The entire player towards whichever way you face while being tethered to a certain point, you can move wherever you want, as long as your holding your button down, but there’s a limit of course. The tether stops you from going too far out, About as long as your arms length, cause that wouldn’t be realistic for climbing. In a way extending the tether a tiny bit, but the tethers length stays the arm length. Making you be able to move as far back as the arm length allows for it. So when you start, and you click and hold depending on how low you clicked the arm will be a specific length.

Example: If your above the point your tether is connected to, basically standing on where you’re holding basically doing nothing (And depending if it’s floor or not you’ll be either standing on it/you’re on the floor, or if you’re for example you jump down to a pole and grab it while above it, you will be under it and hanging from it.)
If its at torso length It will slightly pull you forward but not too much (Also depending if you’re standing on the floor) but then limit your movement since you’re attached, and this applies for everytime you’re attached in any position.

If it’s above you it will pull you up to where you’re hanging, below the point the tether is attached to (Depending on how far up the point of where you’re grabbing is, the more you’ll be pulled cause of the length). The less the distance is the less the arm is stretched out, the further it is, the further your arm is stretched out. The closer you move to the point the closer your arm is (And so goes for the rest of the behavior)

And if you’re on the ground lets say close to a ledge, and you grab said ledge and walk off of it you will then fall and then the tether will hold you from falling completely making your behavior to the hanging behavior making the point above you instead of below you

S = The opposite of moving towards the way you face and moves wherever the player doesn’t face, as long as your holding your button down, The entire player, but still follows the limit rules

A = Moving the player to the left side, as long as your holding your button down, with limits ofc.

D = Moving the player to the right side, as long as your holding your button down, with limits.

You can use A and D to swing left to right, and W and S to swing forward and back.

Space = Detaching all of your hands and Launching you up at the Z axis

LMB and RMB holding = shooting a line trace and wherever it hits the tether attaches from that point to you, And then sets the movement mode to flying and enables the grabbing bool variable that checks if you’re grabbing to true (It changes depending on the hand)

And that’s where the event tick comes in: It’ll check with a branch if one of your hands are grabbing something. On true then it’ll pull the player towards the position of where-ever you’re grabbing and limit your movement, you can move a tiny bit as I said, but not so much that you can reach the end of the map.

Releasing LMB And RMB = The grabbing bool will be false (Depending on the hand bool) there for the hand the event tick for the one hand that you let go will stop enforcing you to have a limit and it’ll then check if the other hand is grabbing, and if that’s false it’ll set the movement mode to (Falling) (Also I forgot to add the branch that when taking the screenshot, Just wanted to point that out incase of confusion) making you into a normal player character that can move freely again! :smiley:

And to answer other questions

  1. If you’re on the ground and attach one of your hands to the wall (It will lift you a tiny bit to where your hand is attached and just dangle you, until you let go or move with the controls above. The lower your hand attaches, the lower the less your likely to see yourself being pulled towards it, due to your character being essentially above where you’re holding (This doesn’t need a dedicated system btw, it’ll just react that way naturally.)

  2. If you attach yourself on two opposite walls? (Depending on if you can reach the wall you can attach yourself to the other wall, essentially making you float in the middle like spiderman holding the boat together)

  3. The tether doesn’t break or get removed unless you release one or two of your hands (If you release one of your hands the wall that hand was grabbing will not be grabbing it anymore but the other one will still be grabbing the position that one was grabbing. unless you release that one aswell)

I’m so sorry for the novel lol, If anything is confusing or doesn’t make sense pls say so.

I think I got it.

It is no a tether per se but you are grabbing with a hand and pulling that way.

You are not limited in your movements direction but you can’t move further than X (the length of your arm) from any of the anchor point.

I’ll have to think about it a bit and maybe try some things out.

P.S.
Find some free lessons in linear algebra. I can personally recommend Khan Academy but there are many others. This kind of math is really useful if you are serious about game development.

I did something which roughly matches your description as far as I can tell. I’ll post the BPs here and hope they help you spin your own logic around them.

First, create a Tether Component. It has only one job - to check how much is stretched and to make a force vector based on that. It also detaches if it’s stretched too much (which might not be desired)

Next attach two of those to a simple pawn along with a flying movement component. Most of the logic here is to take a point under the cursor on the plane of the pawn. Most of this should probably be changed with your control scheme.

Make sure to set your max movement speed low (500) in the FloatingPawnMovemnt, otherwise you’ll break your tethers. And set your collider with some high Linear Dampening (2) and check Simulate physics.

You’ll end up with something like this:

Thanks I’ll try giving Khan a shot!

So I tried recreating what you’ve achieved in your component and blueprint, and I’ve made the component “Tether“ and the other code for it to work in the Player BP. And I tried integrating the system into my player bp. And I’m having major issues, cause it doesn’t wanna work at all. Idk If I did anything wrong in the creation of the bp’s or if I missed something, I took some screenshots:

Also context:

Also In the event tick one which is the final image below, I couldn’t make a multiplication with 1 vector and 2 floats, Idk how to convert a vector to a float or if it’s even possible so, So that’s why there is only one float var.

And the bug is that:

When I attach myself to a wall, my character just falls to the floor and only moves where the camera is looking behsides up, and doesn’t get pulled at all.

Also! You might notice the vector * float is 100. I changed it cause if it’s higher it’ll either pull me back towards a specific spot then I can’t move at all, or it’ll slowly drag me to a new spot for some reason. It’s random. And if it’s highest, it’ll just ping pong the character

I don’t usually do that but here you go:

TetherComponent.uasset (148.1 KB)

SidePawn.uasset (139.2 KB)

I’m not sure if these assets will retain their links like that but try to fix them. Play around with them. I know they are far from perfect but if you can figure out how they work you’ll be able to make the ones you need yourself.