3
\$\begingroup\$

I've been interested in rope physics recently—I've successfully implemented a simple Verlet rope with moveable ends. Now I am trying something a little different: I want to start by recreating the mechanic from the game Sky Tourist (video here):

screenshot from Sky Tourist: two rope endpoints and a sliding weight

I assume Sky Tourist uses Verlet integration for its rope, but it also has the main character sliding along the rope as a moving weight. How can I recreate that?

Is it just done by applying different gravity to where the character is? Also, how is the collision detection handled between the character and the rope? If the game uses a physics engine like Box2D, how does it make it play nice with the rope, considering it's not a part of the Box2d world?

\$\endgroup\$
  • 2
    \$\begingroup\$ Looks to me like the rope is just rendered after the fact. You have three main nodes, the player, and the two rockets. The player's position is adjusted based on the position of the rockets, seems to be a minimum distance from the bottommost rocket. The rope is probably drawn on after, with some gravity/velocity effects, making it connect to the three nodes. You can easily create a rope like this, by attaching a bunch of nodes together at a min/max distance to fake the rope slack. jgallant.com/images/ropetest.gif \$\endgroup\$ – jgallant Oct 17 '14 at 12:37
  • \$\begingroup\$ @Jon That sounds like it should be an answer. \$\endgroup\$ – Anko Oct 17 '14 at 13:39
  • 1
    \$\begingroup\$ Another alternative could be a mass-spring model string simulation. This paper graphics.stanford.edu/courses/cs468-02-winter/Papers/… describes how to do it in 2 dimensions (a piece of cloth), but it's trivial to reduce to 1 dimension (a rope). Especially in one dimension, it's cheap enough to calculate it for realtime use. \$\endgroup\$ – Appeltaart Oct 21 '14 at 22:52
1
\$\begingroup\$

Assuming the rope has no weight, this problem is about finding the lowest point of an ellipse (http://en.wikipedia.org/wiki/Ellipse ) where (PF1+PF2 == rope length)

This image show how the ellipse is rotated.

enter image description here

From there you can figure out the lowest point by tracing the ellipse with a binary search to find the lowest point. That's where the weight should end up, move the weight toward its target with the usual inertia smoothing.

calculate how the drawn rope is going to stretch and pull to accomodate the weights' inertia and you can add some bouncyness.

Add a little bezier sagging to the drawn ropes for realism and you're done.

Cheers,

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.