Search Unity

Discussion Trail Renderer vs Line Renderer vs TRAILS :P

Discussion in 'Scripting' started by AnimalMan, Oct 1, 2022.

  1. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Trailers Y Offset - YouTube

    Y offset for the trail renderer would go a long way, I feel having a second transform object just to host the trail renderer at a suitable Y in the above instance is a little overkill. As you can see in the above video, the angles that it clips below terrain are probably the same angles that require math rounding.

    Would i be better off converting a line renderer into a custom trail blazer?

    i'll be having up to 4 per unit, perhaps more if specified, some units only 2, some only 1, but possibly 100-150 or so units max could be active on the game map at any period of time. Blasting trails and tracks from wheel positions even when off screen. Though limiters on trail producers can be implemented.. The method of trail production should be the most efficient it can be.

    What are your thoughts? Are there as high a quality alternatives as the built in Trail Renderer? I will be splatting craters on the map, possibly via throwing a rotatable plain, but that's another story. Maybe a pool of planes or a pool of trail segments would be the ultimate? Considering here that we will want to see if an AI had passed through an area even if we were not rendering his object at the time, meaning not rendering offscreen trails is not really an option. (Unless of course they exist as data for rendering purpose in which case line vectors could be the only solution)

    I feel like a line renderer constantly fading out could do the trick for the Y offset. What do you think? What are some alternatives? Are there any alternatives?
     
    Last edited: Oct 1, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    I would use layers and two cameras.

    Make the LR / TR be on one layer seen by one camera, the overlay camera.

    Set it to draw above the main camera and to clear depth only.

    See every other layer with the other Main Camera.

    Put both cameras under a single Transform and move that when you want to move it.
     
  3. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    One flaw would be if the hill is > 1 height that the tracks on the far side would render in front of the tracks on the near side.

    sorry I mean. In front of the terrain
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    True. Another way is to just lift up the TR so it isn't so close to the ground.
     
    AnimalMan likes this.
  5. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    Multi object one for each wheel. A little stack of Transforms can’t be that bad can they? i think I’m overthinking it
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,742
    A little stack of Transforms is part of this nutritious breakfast.
     
    AnimalMan likes this.
  7. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164


    Check this out Kurt;

    Code (CSharp):
    1. MODEL=TESTOBJ;
    2. TURRET=TURRET;
    3. TURRET_OFFSET=0,0.5,-0.085;
    4. SPEED=0.1;
    5. UNIT_ROT=0.02;
    6. TURRET_ROT=0.1;
    7. HEALTH=1000;
    8. ARMOUR=1,2;
    9. ARSENAL=;
    10. TRAIL_OFFSET=-0.2,0.2,0,0.2,0.2,0,-0.2,0.2,-0.3, 0.2,-0.2,-0.3;