0

I'm trying to make a rubber band in Unity and I don't get out. I found this example but it's done in Actionscript Flash https://www.deviantart.com/willmh93/art/Ball-Elastic-142211333..... and I can't even convert the code to javaScript or C#. I managed to do something similar, but this one uses line renderer, and it's not so real. Sling Shot img

My simulation uses the Slingshot mechanism, but it doesn't benefit me. I want to have this rubber band and act on a draggable object. I don't need you to write me code, but give me some ideas or some sources from which I can orient myself, what and how to use it to get the same result.Thanks a lot.

Djpokker
  • 11
  • 7
  • Here's a rope simulator which may be helpful ( https://assetstore.unity.com/packages/tools/physics/obi-rope-55579 ), though looking at the image you may also get away with a much simpler two-lines-and-split-point type of simulation for your needs? – Philipp Lenssen Jan 27 '20 at 20:33
  • Yes, but I do not know how successful this asset is ... and if it respects my needs. I need elasticity, specific to a rubber band. As shown in the picture ... if I drag an object, then the rubber band will stretch and if I let it go apply the force on the object. – Djpokker Jan 27 '20 at 20:37
  • But from what I read about the asset, I think it represents my needs. :) – Djpokker Jan 27 '20 at 20:41
  • You could ask the creator of this asset if they think it can cover your use case. Last time I emailed them, they were responsive. – Philipp Lenssen Jan 28 '20 at 09:00

1 Answers1

1

I believe you are looking for Spring Joint:

https://docs.unity3d.com/Manual/class-SpringJoint.html

It allows you to attach 2 objects with springiness. I'm sure you can fiddle with the values to get a more 'rubber-band' feel.

  • Thank you very much ... I tried, and played with all the possible options on the Spring Joint .... and did not give me desired results. ))) – Djpokker Jan 27 '20 at 21:04