How to let the user draw lines in a 2D game?

Hi there,

i am thinking to make a 2d game using Unity. the idea of the game is similar to

free rider. i was wondering if i could draw lines like in the game free rider(i.e when the user plays the game he could draw the lines while the game runs). if it is

possible, then how? if not, is there any other alternative or other game engine i could

use to do that?

here is the link to free rider game if you are unaware of the game-

The answer to “if it’s possible” is simple this as it’s made with Unity. However it’s not as simple as it looks like. The problem is actually two-fold. You have to drawn the lines and also have to construct a collider from the drawn lines.

To draw lines there are multiple solutions to that. Either use a third party framework like vectrosity, use a line renderer or build a mesh from the drawn points.

As collider you can use the new PolygonCollider2D or, as in max and the magic marker, build a mesh collider from the points.