0
\$\begingroup\$

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

http://a2.mzstatic.com/us/r30/Purple5/v4/de/12/0f/de120f2c-14a7-57a3-404a-a7d90280c572/screen568x568.jpeg

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.

\$\endgroup\$
  • \$\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
1
\$\begingroup\$

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|||||
\$\endgroup\$

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.