Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Simple Skidmark Setup for Your Unity Racing Game

Discussion in 'Community Learning & Teaching' started by JamesArndt, Jan 29, 2013.

  1. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    This is a very simple tutorial on setting up skidmarks for any racing vehicle in your Unity projects. This method is independent of the type of vehicle or environment. It is also mobile friendly for your iOS or Android applications. The method I describe makes use of Unity's built-in WheelColliders and their "WheelHit" property. It also makes use of small Trailrenderers to render our tire tread marks behind the vehicle. As usual here is the link to the video, and don't forget the full source Unity project download link is in the video description! Enjoy.

     
    slaczky likes this.
  2. raiden

    raiden

    Joined:
    Feb 8, 2009
    Posts:
    333
    Great stuff James, thank you for this!

    -Raiden
     
  3. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    Thanks for the tutorial!

    I noticed an issue, though. As soon as you stop skidding, the trail disappears. That means that if you're following a car, you're going to see the skidmark disappear abruptly. Any way to fix that with this technique?
     
  4. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    It's actually not an issue, it's the way the TrailRenderer works by design. I discuss this in the video, that you can adjust the length in time of the skidmarks. They don't ever "abruptly" disappear, they fade away according to the time setting. I even stated in the video that the reason it's mobile friendly is this very reason, the tire marks do not stick around all over the world like decals (works more like a particle). If you're looking for a way to set decals on the world, it can be easily implemented right into these very scripts, just might take some Googling on how to place a decal and then kill it off over a period of time has elapsed.
     
  5. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    Just after 6:15 in your video, you can see the car start to skid and leave tracks. As soon as it stops skidding, the tracks completely disappear. They don't disappear over time unless you continue to skid.
     
  6. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Well yes that's part of the optimization. The trailrenderer doesn't stay active 100% of the time, it's only active while the tires are skidding. When they are not skidding, they won't produce any tire marks (just like real life). So they do turn off. You could go in and script in some extra fanciness like fading out when they stop or a puff of smoke to hide the tire marks not being produced anymore, it's basically up to your own project and creativity. My main focus was to make sure this worked well on very limited platforms.
     
  7. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
    Use this in conjunction with the driveable vehicle and skidmarks tutorial and you've got yourself a racing game!
    These are low poly modular street sections and buildings that can be used to populate your own city in Unity. The video demonstrates how to use the pieces and contains the download link for the Unity project source. Enjoy!

    Modular City Kit on Youtube

    If you'd like several other free Unity project downloads visit:

    fatbox Software Resources Page


     
  8. JamesArndt

    JamesArndt

    Joined:
    Dec 1, 2009
    Posts:
    2,932
  9. Tupp

    Tupp

    Joined:
    May 10, 2013
    Posts:
    1
    I am very new to unity but I found your videos to be amazing :D.

    Keep up the great work and good luck with your Super Kart Game