- Home /
The question is answered, right answer was accepted
How to make a string to connect 2 object - not string variable,
Hi, I have, for example, 2 cubes, and I want to connect one corner of this cube to one of other cube by a string, like this
When I move cube one - assuming the right one, I want the left to be moved after. On the other hand, I want to make it like in the real life with tension, inertia force, and gravity. So please tell me how to make it. Thank you in advance.,
Answer by nyonge · Aug 08, 2016 at 07:54 AM
The easiest way would be to grab an asset from the Asset Store that gives you this functionality, like QuickRopes. http://u3d.as/2Rh
To do it yourself for free you could play around with Unity physics. A relatively simple way would be to create a bunch of small cylinders beside each other, forming your rope. Put Rigidbodies on them and use joints like Hinge Joints to connect them all together, and connect them to your cubes (which would also need rigidbodies).
There's looooots of ways to do what you're describing, but those would probably be the simplest in Unity. Good luck!
Thanks. I am a high school student, and this is my first project in my learning. So I want to make it as cheapest as possible. I found a tutorial and I will do it tonight.
Answer by shahzaib · Aug 08, 2016 at 02:12 PM
giving objects a tether effect is pretty easy to achieve and can be done with "hinge joints" between the two objects and by tweaking the "spring" value, you will get the tethered (or hinged) object moving with slight delay or tension.
Glad if that helps!
Thank you so much. It really helped. I googled it and I found some tutorial for myself. English is not my mother language, and I should have called it "rope", not a "string". Anyway, thanks again
Follow this Question
Related Questions
How do I programmatically Combine Inertia Tensors? 2 Answers
My Mecanim-Generic is screwing with the gravity 2 Answers
Rigidbody unwanted drifting 3 Answers
Tornado throwing back force after pulling 1 Answer
Addforce.forward on a sphere object 1 Answer