Saturday, May 4, 2024
HomeGame Developmentunity - Springy / Stretchy rope

unity – Springy / Stretchy rope


I have a 2D rope cutting game similar to cut the rope, and I want to add ropes that can be extended further than if it laid flat. Easy said: I want to stretch the rope.

Currently I have a parent game object, and following child objects:

Anchor Start
Rope 1
Rope 2
Rope 3
...
Rope 7
Anchor End

Each object has a hinge joint with the Rigidbody2D component set to the Rigidbody2D of the gameobject above in hierachy. Anchor End has Rope 7’s Rigidbody2D, and Anchor Start has no Rigidbody2D. When I try to move an anchor far away from the other one, the rope parts glitch out.

Is there a way to spawn new rope parts when the rope gets streched too much, or to scale the existing parts accordingly?

I don’t neccessarily need those following features, but it would be great to have them since I want to add them in the future:

  1. A way to tell how stretched the rope is (In Cut the Rope the ropes turn red when stretched a lot, I would like a similar effect)

  2. A variable that controls how stretchy the ropes are (0 for no stretching, 1 for full stretching)

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments