1

I have a rope that was created using SKPhysicsJointPin. On both ends of the rope are two different Sprites/PhysicsBodies that are attached.

If I move one of the attached Sprites with an SKAction, the rope tends to pull apart and then eventually settle after some time.

An example project that is similar to what Im trying to achieve can be found here, Rope Git Project

If a move action is added to the branch you will see a result similar to the gif posted below.

Is there any way to prevent the separation of joints?

Thanks in advance, Ben

Stretching rope

cheaze
  • 187
  • 1
  • 14

2 Answers2

2

Ok I found out that running an SKAction moveBy or anything that changes the sprites location doesn't play well with physics.

What I should be doing is either altering the SKPhysicsBodies velocity directly or applying impulses/forces to it.

There is also an SKAction runBlock method where you can set the velocity, and SKAction applyForce / applyImpulse etc.

This fixed my joint stretching issue :)

cheaze
  • 187
  • 1
  • 14
1

I had a similar problem when trying to make a bicycle-type chain run around sprockets. The size of the connecting physics bodies does seem to have some bearing on the stretchiness. Initially I had very small radius physics bodies on the chain links (<1 point). After I upped the radius to 3-4 points, the chain became much more robust and much less likely to stretch or break. This made the difference between shelving the idea or moving forward. Also, make sure joint anchor position is within the physics body area on both nodes, not just close-by. This too seems to have some bearing on how robust the joint is.

Simon Ward
  • 11
  • 1