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. Dismiss Notice

Leaving wheel tracks on the terrain

Discussion in 'Editor & General Support' started by Cheburek, Apr 29, 2013.

  1. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    384
    I can't seem to find anywhere how to do this. I have a tank that rolls over soft dirt, and I would like to leave tracks behind it.
    $42-juvie-in-tank-track-military.jpg

    Im using Unity terrain.

    Thanks for help.
     
  2. Jmanpie

    Jmanpie

    Joined:
    Oct 7, 2012
    Posts:
    132
  3. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    There is the TRAIL RENDERER in the EFFECTS components.
    But this of course does not stick the vertexes in place, you'll have to modify it.
    If you are a coder with a little experience in mesh works it shouldn't be too difficult.
    And when you have it ready, please send it to me as I'm doing some stuff with tanks as well eh eh :D
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,400
    I've done this before:



    I could make an asset from it if there's interest, though I'd have to clean it up, write docs, etc.

    --Eric
     
  5. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    Wow that looks quite cool!

    I was thinking if there's any way to pull this off from the particle system... going to try this right NOW as I'm too curious :D

    Of course, it will be nothing continuous and well defined like a dedicated solution.
     
  6. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    Done! And it's not too bad! (as a placeholder :rolleyes: )

    Now I'll try with the trail renderer.
     
    Last edited: Apr 30, 2013
  7. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    Well trail is not good for this for 2 reasons: first, as said, it doesn't "stick" the texture there, it trails it, and second, vertexes are oriented to the camera, and not flat or oriented like the terrain.

    But particles are not too bad to start with.
     
  8. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    384
    I dont understand how can you use particles to achieve this effect?
     
  9. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    384
    I don't want to deform the terrain tbh. I just want to leave a texture/flat trail on top of it.
     
  10. AustinRichards

    AustinRichards

    Joined:
    Apr 4, 2013
    Posts:
    321
    You can have the particle emitter right at the bottom of the wheel, and have a textured particle (a square piece of the track) which will face up and not billboard.
     
  11. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    Emitter sphere radius 0.
    Particles work in world space and speed=0.
    Set the rendering as horizontal billboard.
    Set the material as multiply.
    Give the particles 20 seconds life.
    Set alpha to full for the first 80% lifetime, and then put alpha to 0 at 100% lifetime.
    Now, put one of these particles systems as children of your vehicle, at the base of the wheels.
    NOT children of the wheels, or the particles system will rotate with them! LOL

    This won't work nicely if your vehicle is fast though, and it's only something that leaves a trace... nothing as detailed as Eric's solution, but it's something that remains on ground where the vehicle passes.

    Also, if your vehicle can jump, you will have to check if the wheel is in contact with ground or not, and deactivate/reactivate particles generation accordingly... or you will have trails on air :D
     
    phmello8 and elettrozero like this.
  12. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,066
    @Eric - would love a sentence or two on how you did yours. That looks pretty nice :) I'm "in the market" for something similar at the moment, but for blood trails (as bodies are dragged around). Lovely, I know.
     
  13. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,400
    Basically I use the Mesh class to create quads using info obtained from raycasting. Seems like it would probably work for blood trails, since it's not actually tied to vehicles per se; you attach the tire track script to each object you want to have a track (I found that only attaching it to the rear wheels generally looked better, at least for what I was doing, even if it's not "correct"). It handles discontinuous tracks in case of wheels leaving the ground.

    --Eric
     
  14. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    Quite cool.
    Any chance to see it on the Asset Store?
    I think it would have a "market" :)
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,400
    Yep...I was probably going to do that at some point anyway, but I'll bump it up higher on the list.

    --Eric
     
  16. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,324
    That's cool, make it a popular price and I'm going for it for sure :)
     
  17. Cheburek

    Cheburek

    Joined:
    Jan 30, 2012
    Posts:
    384
    thanks for help guys, Ill give particle system a shot.
     
  18. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,841
    Sorry for the necroposting... but this is the most relevant result I could find. I checked the asset store too, but couldn't find anything there.

    Did anybody ever make a good solution for this (leaving wheel tracks on the terrain)?
     
  19. Carpe-Denius

    Carpe-Denius

    Joined:
    May 17, 2013
    Posts:
    842
    Unity standard assets have a car Controller with wheel tracks.
     
    JoeStrout likes this.
  20. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    This popped up in my Twitter feed today with the #madeinunity hashtag, looks like proper 3d tire marks, maybe it will appear as an asset soon, fingers crossed :)
     
  21. khos85

    khos85

    Joined:
    Jul 21, 2013
    Posts:
    541
    Hi, I realize that is an old thread, but did you ever get your nice sounding asset done, I would like buy it.
    Thanks.
     
  22. ZoneOfTanks

    ZoneOfTanks

    Joined:
    Aug 10, 2014
    Posts:
    128
    Any result? :rolleyes:
     
  23. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    Best I could get is with the transparent fade shader. It behaves night and in sunshine as supposed. With the transparency value of the albedo you can set the strenght of the trail. This is based just on transparency, so no color is tinted (except black) to be able to use them on different terrain texures. I drop them by building a mesh a bit over the terrain, but maybe it could work with particle/trail too.

    What I could achive with just an albedo, no normal map, just playing around atm.:

    bandicam 2017-06-03 12-56-07-677.jpg
    With this diffuse map:

    TrailTest5.png

    Created in blender by using eboss feature of the Fu-Script plugin. Then I disabled the source image layer. However, this image is just for playing around. The transparancy comes from the alpha map.

    Even if you going to use a tesselation based mesh trail, you still have to paint in the mesh based trail a texture.
     
    Last edited: Jun 3, 2017
    Griffo likes this.
  24. initer

    initer

    Joined:
    Nov 19, 2018
    Posts:
    8
    Hi. Do you have any tips, how to get this prefabs? :))
     
  25. mkgame

    mkgame

    Joined:
    Feb 24, 2014
    Posts:
    592
    I got the track making asset from a bigger asset and modified it for my purpose. This asset works like a mesh making manager, which provides different tracks. It builds up a mesh in a way, that it adds mesh faces after a certain movement distance. The maximal mesh segments can be also defined, after reaching max, the oldest segments are removed. Try to search for a car asset with track support.
    This solution is fast, but could be 3d track with tessalation or terrain mesh modification (makes no sense with Unity terrain).
     
  26. bearlike

    bearlike

    Joined:
    Mar 11, 2016
    Posts:
    6
    Hi, could you tell me what is the name of this asset?
     
    JoeStrout likes this.