Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

How To Know If You Are On Track (Top Down 2D Racer Track)

Discussion in 'Editor & General Support' started by renman3000, Aug 20, 2018.

  1. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    Hi there,
    If you were to develop a top down, 2D racing game in unity, where the player must know if it is on or off the track, how would you do this?

    Currently I think my best option is to create the track pieces in Illustrator, port to Blender as svg and apply a Mesh Collider to the models. This would give me a precise collider at each track segment.

    That said, I am wondering about alternatives, in terms of performance to the engine.

    Any ideas?
    Thanks




     
  2. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,912
    I think collision serving as "triggers" would work just fine in this scenario. You can easily check when the player is within the bounds of a specific shape, or outside of it. You can also use the more optimized 2D collider shapes as well.
     
  3. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I think Unity's new 2d tools let you create this kind of geometry in the editor.
     
    JamesArndt likes this.
  4. JamesArndt

    JamesArndt

    Unity Technologies

    Joined:
    Dec 1, 2009
    Posts:
    2,912
    renman3000 likes this.
  5. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,680
    Wow. Did not know it existed.
     
    JamesArndt likes this.