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

Trail Renderer for endless runner.

Discussion in '2D' started by Charlesf2, Jan 3, 2015.

  1. Charlesf2

    Charlesf2

    Joined:
    Jan 12, 2013
    Posts:
    6
    Hello everyone.
    My wife and I are working on a project and we've come up on a bit of a roadblock.

    We're making an endless runner and we'd like to use the trail renderer because we like the way it handles arcs because our character will jump alot. The trouble is, we've set it up so our character doesn't move horizontally, only up and down. Is there some kind of work around for this? Some way to tie the horizontal input to the scrolling background and tie the vertical movement to the character? Is there a way to get trail renderer to behave the way we want it to without reinventing our entire script?
     
  2. wizardious

    wizardious

    Joined:
    Dec 31, 2009
    Posts:
    189
    This is a difficult problem, because the trail renderer is based on velocity, if the player has no forward velocity, the trail renderer cannot emit backwards. I thought maybe, 1. create an empty game object 2. attach a trail renderer 3. attach a constant velocity with one direction.. 4 connect the empty to player with a hinge. I tried this and had trouble getting the behavior I wanted. Perhaps it could work, but I could not get it to function as you want.
    As a fallback you could try attaching a particle emitter to the player and limit its velocity to the rear of the player. Perhaps a single particle? Not sure if you can get the same behaviour as the trail renderer, but you might be able to get something you will find acceptable.
     
    Last edited: Jan 5, 2015