- Home /
Connecting two objects with another object
Hello,
First off, I apologize for an unclear title - I didn't really know how to describe the problem.
This is the kind of object I wish to make:
In the above picture, there are three circular objects that are "connected" by a line. The circular objects will receive force in a random direction. The lines connecting the objects will stretch, retract, and re-position itself as the objects get pushed around.
I would do this with a LineRenderer, but the lines need to have colliders. Also, I was considering using a plane object, but to do this, I would have to come up with a function that stretches, rotates and re-positions the plane based on two connecting objects' location. I think can do this, but I also have a feeling that this is not the optimal way of doing this.
My question is this: is the above mentioned method the only way to achieve this, or is there a much cleaner method of doing something like this?
Thanks!
Answer by robertbu · Mar 10, 2014 at 05:46 PM
Positioning and rotation your quads to connect the disks is easily done. You likely want to use Rigidbody.MovePosition() and Rigidbody.MoveRotation(). But in looking at the diagram I have to wonder if using a hinge or spring joint would work.
Hinge component is perfect for what I am looking for. Thanks!
P.S. Could you write something below so I can mark it as an answer?
You can press the tick under the thumb down. I just did for you though.