ios - I joined multiple images into a rope. How can I decrease the rope stretchiness? -


i created rope based off this tutorial, except rope has 1 ball attached on each end of rope.

high level: how create rope.

  1. create array of sknodes
  2. append each rope segment (node) array
  3. add each node screen
  4. join each node form rope
  5. (then add ball on each end of rope)

in program move ball around , swing rope around kind of stretchy pendulum.

here's issue: if swing rope around hard, rope stretches much! how can decrease amount rope stretches? don't see method decrease elasticity of body.

if there other information useful please let me know! in advance

you can try these 2 methods. first method increase property frictiontorque of skphysicsjointpin class.

the range of values 0.0 1.0. default value 0.0. if value greater default specified, friction applied reduce object’s angular velocity around pin.

an example tutorial followed, before adding joint scene, modify frictiontorque:

for in 1...length {     let nodea = ropesegments[i - 1]     let nodeb = ropesegments[i]     let joint = skphysicsjointpin.jointwithbodya(nodea.physicsbody!, bodyb: nodeb.physicsbody!,         anchor: cgpointmake(cgrectgetmidx(nodea.frame), cgrectgetminy(nodea.frame)))     joint.frictiontorque = 0.5    // add line      scene.physicsworld.addjoint(joint) } 

the second method limit swing angle of pin joint. after enabling shouldenablelimits, adjust loweranglelimit , upperanglelimit in radians.

read more skphysicsjointpin class reference determining characteristics of pin joint.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -