Search Unity

Top Down 2D: How do I keep my character boat in winding river?

Discussion in '2D' started by wyattbiker, May 30, 2016.

  1. wyattbiker

    wyattbiker

    Joined:
    Sep 4, 2014
    Posts:
    18
    I am new to Unity3d but an experienced programmer. I am looking to make a top down game (zx axis) where my boat character moves (using WASD keys) on a randomly winding river (like the Amazon) which varies in width. The boat can move anywhere in the river, but not beyond the river banks. What do I use to define the river bank boundaries, so when my boat strikes it stops going on land? Do i need to create thin wall colliders? Is it raycasting? Any examples/ideas would be appreciated. Thanks.
     
  2. Hyblademin

    Hyblademin

    Joined:
    Oct 14, 2013
    Posts:
    725
    Have you tried polygon colliders for this? I think it's the simplest approach. I don't know if your river shape is made of prefabs or is generated, but you could do either with polygons.