Search Unity

Footstep/Track trends graphics

Discussion in 'Scripting' started by AtomicAdam, Jan 20, 2014.

  1. AtomicAdam

    AtomicAdam

    Joined:
    Nov 16, 2013
    Posts:
    13
    I have a top down 2d game. I am using Unity 4.3.2 and C#

    I have tanks and jeeps and my game currently that move around.

    However, I am trying to have them leave tracks behind. like tire/tread marks

    something like http://www.cdc.gov/niosh/fire/images/200825P2.jpg

    I originally tried using 0 velocity particles, but there are numerous issues with that approach like rotation and textures vs sprites and other things.
    I am using the build in Trailrenderer for the planes just fine.

    However I was going to try and do it by hand. Just script somethign that leaves a single 'graphic' there for say 2-5 seconds(or longer?) and itll fade out and destroy itself after that, or reallocate into the tank's pool of potential tracks.

    However, is there a way I can do this without having 10 child gameobjects with their own specific transforms and other overhead?
    I come from a different environment from Unity where I would just have some list of 10 elements and just call draw/render x/y on their needed places.

    Also would like to keep overhead down since there will be an unknown number of tanks on the screen, and if the tank dies and the treads are child, then they go poof too. So unless I had a TreadManager object that handles all of the tracks/treads. I am a bit lost?


    tl;dr; Ideas of how to implement leaving tread/track marks behind after vehicles?
     
  2. TheShane

    TheShane

    Joined:
    May 26, 2013
    Posts:
    136
    You should check out the new sample assets. There is a car example there that leaves tire marks. It's in 3D, but it should be no problem to adapt it to 2D.

    I'm not sure how it works, actually, but I was just looking through some of the new demo scenes and remember the car was leaving marks.
     
  3. AtomicAdam

    AtomicAdam

    Joined:
    Nov 16, 2013
    Posts:
    13
    Excellent, Thanks! I'll check it out