I want to create a similar line RigidObject in Unity c# just like in the iOS game Circle:


So far I placed a cube object that is extended by length.

So, how would you approach to create such an object?

I tried with a for loop where I was trying to add a cube at the end of the other, but the rotation messed everything up.

I don't want to create a prefab, since I want the lines to be random and different every time the player starts the game.

  • \$\begingroup\$ You could do this in 2D using a LineRenderer, and some BoxColliders. \$\endgroup\$ – jgallant Aug 8 '16 at 11:13
  • \$\begingroup\$ but is linerenderer a rigidbody, will it react to collisions? \$\endgroup\$ – mirzahat Aug 8 '16 at 11:16
  • \$\begingroup\$ Yeah, you can add a rigidbody to each node in your line, if that is how you want to deal with collisions. \$\endgroup\$ – jgallant Aug 8 '16 at 11:19

Use an Edge Collider to map the collision, and a Line Renderer to render the line. Both of them take an array of points, and will make the line/collider as you specify.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.