- Home /
Unity 2D add make a line with collission
Hey,
i made a ball which is placing rectangles.
But my problem is this jagged line. Maybe this method also needs a bit to much memory :S. I searched and found the question ( Something with dotted lines ) and there suggest to make rectangles and use them as collider.
Better is to find a method to create vector lines with collision.
Maybe someone can help me.
Regards
LifeArtist
http://www.starscenesoftware.com/vectrositydemo9.html You could mix that with http://www.starscenesoftware.com/vectrositydemo7.html if you want.
Answer by Eric5h5 · Mar 18, 2014 at 03:12 PM
Create a mesh in the shape of the line, and use the mesh points to create an edge collider. If you don't want to do this yourself (there's quite a bit of programming involved, too much to just answer here), see the links I posted as a comment.
But i dont want only a line. I want a line with some thickness. Do u know a solution to solve this ?
The line can be whatever thickness you want. See the links I posted.
Answer by tobyfee · Mar 18, 2014 at 03:06 PM
Bad news: Unity has method for creating colliders that are just lines.
There isn't a great way (that I know of) to allow someone to freely draw complex shapes that then become colliders.
To make this work easily, and change the basic function of your game, you could force the ball to move only in a few set directions, say 8 directions, and then create a stretched rectangle each time the ball turns.
If you meant "Unity has no method for creating colliders that are just lines", that's incorrect. The edge collider does this.