Search Unity

Character Movement on Curve like path , Like in Temple Run 2 or Catch The Ark

Discussion in 'Scripting' started by ritesh_khokhani, Feb 3, 2014.

  1. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47
    HI,



    i wann make game like Catch The Ark,

    i have made path/map generation which works fine at all,

    but i stuck totally in terms of character movement in curve like path, same as Temple Run2 or Catch the Ark, or Temple Run OZ,

    i have tried with ray cast to make some fixed distance with respect to path borders, it works fine with straight map generation, but jitters with curved map/path!


    please help me!
     
  2. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    If you only need the player to turn right / left at curve sections, a trigger which gradually rotates the player 90 degrees left / right should suffice, but that's just me thinking out loud, haven't attempted anything of the likes.
     
  3. Lasent

    Lasent

    Joined:
    Dec 27, 2013
    Posts:
    27
    I would try and add another GameObject, that's only moving in the middle of the road, looking always forward, then have the player's GameObject be a children of this.
     
  4. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Well, since those games are "tracks-like", as in they have specific tracks in which the player can run in, you'll probably need some kind of spline or path to define where those are, and place the player in relation to that path.
     
  5. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47
    HI Lasent, first of all thankx for reply,


    here i would like to say that, path which i have to follow are now straight, it is curve based , same like temple run 2 or temple run oz,


    here problem is that how i can run GameObject in the middle of road/path??
    and how i would achieve it would be always in the middle of path!
     
  6. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47
    @LightSriker,

    you mean i have to use Waypoint like thing, which player is following, m i right or anything else you suggest?
     
  7. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Here's an example of one piece of road we use in a game;



    You can clearly see the spline in the middle. The player always follow that to know how the road is curving.
     
  8. ritesh_khokhani

    ritesh_khokhani

    Joined:
    Jun 26, 2013
    Posts:
    47

    hi yes it is showing , but i also have player to bound on left and right side of path, like in temple run 2 and oz, so that i cant collide with walls and not jittering!

    user will have full control of player with tilting of device, but player will not go beyond borders and also follows path whr user left player!
     
  9. souwa

    souwa

    Joined:
    May 27, 2015
    Posts:
    1
    hey! did you solve your problem? i have the same issue and don't know the solution how to move to the right/left in the middle of the road.
    please help :)