Problem aligning character to swinging rope


I am trying to get a character model to climb a rope. The current system i have is almost functioning correctly, but if you climb up and down the rope a few times without dismounting, the character eventually goes out of alignment with the rope, and the hand movement in the animation slowly angles away from the rope until the character is grabbing air.

What i have done is set up a static mesh rope, pivot point at the top. Attached this via a physics constraint component to a static mesh anchor placed just above the rope. The character is animated to move in and jump onto the rope, and this is achieved with a in-place animation in combination with some blueprints to rotate the character towards the rope, then use a lerp/timeline to move the character into place. This aligns the outstretched left had exactly onto the rope. then the characters mesh is attached to the rope static mesh, and force is applied to the rope to make it swing.

This part all seems to be working perfectly, and looks quite good. Once the force is applied, the rope moves around with the mass of the character, and i use a “set world location” node along with a “get up vector” node to move the mesh in the z direction relative to the angle of the mesh, and then i manually move the player controller along with it to keep the camera in place (third person camera).

Theoretically, when the mesh is moved in it’s relative z direction (determined by the mesh being attached to the rope), it should move up the rope in a perfectly straight line at whatever angle the rope is on. But it’s not quite working out that way. It works well for one or two climbs as i said, but as i move up and down it slowly goes out of alignment.

So does anybody have any ideas how i might go about perfecting this? Or am i going about it in totally the wrong way? I have tried to reorient the mesh every update frame to keep it in position, but this has proved difficult to do with the pivot point located at the top of the rope and the rope being on a variable angle.


Update, i have discovered when i turn off simulate physics off on the rope, it works perfectly, so there is no problem with the method. The problem is the rope is swinging slightly before i make the attachment.
Is there anyway to dynamically turn on simulate physics on a static mesh?

instead of assuming the mesh is oriented similar to the rope its attached to, and moving the mesh up relative to itself, you could try moving the mesh towards the pivot of the rope. you could subtract the mesh location from the ropes pivot, to get a vector pointing from mesh to pivot.

if your rope is a chain of bones, and you want to slide along the bone chain regardless of how its bent, then you may want to use a spline component, setting each point to a location on the chain. once you have a spline that matches your bones, you can use GetLocationatDistanceAlongSpline to find locations along the rope.

or maybe, if you are attaching the character to a specific bone along the chain, you can just slide towards the root of that bone, and once you are close, you can attach to that bones parent bone, then slide towards its root.

Thank you for answering Scott. Good ideas, i had though about adding bones to the rope and using sockets, but haven’t tried it yet. That spline method sounds perfect rather than having to calculate something from the pivot. I will play around with this today and let you know how i go.

The spline component fixed the problem, but it’s still not exact. I’m going to add bones to my mesh and attempt a socket attachment step by step as the character moves up the rope. Trying to calculate distances, rotations and velocity’s has been a nightmare, and very inexact, and falls apart when the rope is moving a lot. Thanks for your suggestions.