Create Ground/Walls using your finger

I would like to be able to draw a line with my finger, and when I lift my finger a collider is added to it. The line could be a squiggly line or straight line, it all depends on what is needed. but basically I wan’t to be able to create as many lines as I want, and each line will have it’s own collider. I am pretty sure it is possible to do that, but the question is how?

Basically you use your finger to create ground/walls in the game.

That question was wayy too ambiguous.

I’ll assume you’re trying to make a mobile game?

You’d want something like this:

List <Vector3> Points = new List <Vector3> ();

void Update (){

if (gettingTouched){

      Points.Add (new Vector3 (*WHEREVER THE TOUCH WAS*));


  }

if (userHasLiftedFinger){

    //LINK ALL THE POINTS HERE
    Points = new List <Vector3>();
}

}

It’s not particularly fancy and you could optimize it to only add a point when your finger changes direction but it’s a rough guide.

Take a look at the documentation

1 Like