How do I reproduce this rope physics from Super Mario Party?

0 favourites
  • 5 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • Hello everyone,

    For a side project I'm trying to create a little robot that moves while being on a LEASH that starts from a fixed place. However that leash has been a real struggle and although I've made a good headway it's not entirely satisfying yet.

    1/ The leash needs to follow the robot in a realistical way

    2/ The leash is unbreakable and prevents the robot from moving farther than its max length

    3/ The leash must have some form of solidity so that it doesn't go through walls and poles while trying to follow the robot

    Basically I need a rope that acts pretty much like that rope in a Super Mario Party game (see 41:15).

    I have already produced a base project. LINK HERE

    First I tried to go the Pin (Rope Style) route but the movement was not realistic. My current prototype uses Physics Behavior instead.

    • I am more or less satisfied with how the rope follows the robot although sometimes it does vibrate / pulsate weirdly.
    • It is solid-ish. When you go around poles it does get stuck. But if there is too much tension, the little parts get further and further aparts until the rope actually goes through the pole. The joints are not strong enough.
    • It does not at all prevent the robot to go further than rope's length. The little parts just get further and further apart themselves, as if the "tension" increased, but it has zero effect on the robot. I could reduce the force I apply to the robot by a value representative of the rope's tension but I don't know what formula would fit.

    As usual I'm suuuuper grateful to anyone trying to help =)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok I'm slowly progressing. This is probably not CPU efficient but by measuring the length of the entire rope every frame, I can then increase the Robot's density if it gets too long, as well as the linear damping.

    LINK

    The main problem at this point is that it makes it very hard to drive in reverse when you got stuck because the density remains very high...

    Also the rope can still snap sometimes, but it's much rarer and I feel like by tweaking some values like the speed we can reduce the risk a lot.

  • On the start of layout set high numbers for Physics world stepping, for example 50 and 50, or even 100,100. You need to experiment with this setting, it makes all physics calculations more accurate, but also affects performance.

    Use bigger chain links with much higher density, decrease the number of links. This will make the rope stronger. Say, if I make 100 links with density 2, the rope stretches a little, but doesn't break, unless I start looping it around poles. Unfortunately, it still goes through poles quite easily.

    I guess your method of checking the rope overall lenght can work here, but instead of increasing Lilbot density, you need to decrease its velocity. If the rope becomes stretched, find the nearest pole to the Lilbot and adjust Lilbot's velocity, allowing it to move only towards the pole, not away from it. But I don't know the formulas for that, sorry :)

    You can also try applying an impulse that will pull the Lilbot back (at rope angle) when the rope becomes stretched.

  • Thank you dop2000 for checking it out! :)

    As you suggested I tried to change the stepping parameters but I didn't distinguish improvements, so for the time being I'm letting it as is.

    Weirdly, I felt that reducing the number of rope parts, making them larger, and increasing their density actually made the rope break more easily... It probably needs more testing though.

    However the pole suggestion was super useful and unlocked the situation in a major way!

    I reworked a LOT of things, included the way I compute the rope's length, and now I can determine which is the closest pole in contact.

    I've also stopped increasing the density of the bot, instead I change the force applied to the bot.

    Since we now know which is the closest pole it's possible to apply a handicap (relative to rope's length) or not depending on the angle we move. If the rope is at max length we can still drive in reverse mode for example.

    This is coming together, although the controls of the robot are still really bad... I wish I could simple add the "Car" Behavior to it but it doesn't go well with physics.

    LINK HERE

    I'm still very interested in how I could make this prototype better (be it in its driving or rope mechanic) :D

  • I'm not sure why box2d is so jittery sometimes. Roughly, as I understand it, the way physics sims work is it moves stuff around with gravity and forces, then it loops over all the constraints (collisions and joints) to resolve them. It does that loop multiple times. The higher the iterations the closer to perfect it will be. In the case of rope with infinite iterations it should in theory be a perfectly stiff rope that doesn't stretch at all.

    Anyways, aside from iterations you should be careful with vastly different masses, that also can make things more unstable with something like a rope. As least from tests and what i've read. Your other issue of the rope being pulled through smaller pegs may be helped by links closer together, bigger pegs or even using segments instead of circles for the pieces of rope.

    I did this event based rope based physics to test some stuff out. It's probably much slower than box2d but the results are pleasing to me. The length of the rope is limited as you drag the rope around. Some things such as the pinned end and that it only works with one rope are hard wired in so far.

    dropbox.com/s/8vobbfougch0edt/verlet_rope_test.capx

    Here's also a quick modification to make it similar to you c3 project. The end is moved with the 8dir behavior and it's momentum is set to 0 so it kind of drags behind if the rope gets momentum.

    dropbox.com/s/c7ikyff1z4b7mtl/verlet_rope_test_8dir.capx

    Not sure either are useful. They are mostly just tests for fun. The first half of this post is the helpful part.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)