x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Problem aligning character to swinging rope

Hello,

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.

Thanks, Mike

Product Version: UE 4.11
Tags:
more ▼

asked Aug 16 '16 at 03:52 AM in Blueprint Scripting

avatar image

michaelbaggott
3 1 2 5

avatar image michaelbaggott Aug 16 '16 at 10:16 AM

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?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Spline/GetLocationatDistanceAlongSpline/index.html


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.

more ▼

answered Aug 16 '16 at 12:58 PM

avatar image

ScottSpadea
9.6k 319 205 449

avatar image michaelbaggott Aug 16 '16 at 10:16 PM

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.

avatar image michaelbaggott Aug 17 '16 at 03:20 AM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question