- Home /
Trail after game object with pause/clear function
Hi there. I'm making a game what is teaching kids, how to draw letters the correct way. The game is for mobile platforms (android/ios). In order to do that, I need unity to make a trail after the gameobject(what you drag around using your finger), when I draw the letter.
The problem with the built in trail renderer is, that you can't tell it to clear up all trails, or pause the trail.
Imagine that you are writing a big A, first you do the inverted V, then the trail must be "paused/stopped", so that you can draw the horizontal line across.
If the player makes a mistake, like writing it the wrong way, the player must start over, and the trail should be erased instantly (instead of fading it after some time, like the trail renderer does by default).
I hope you can follow my trail of thought, if not, I can upload some images to try explain it.
I've been searching for some time, but I've not found any trail renderer that solves my problem. If you know of any solutions, I will be truly grateful!
Answer by rutter · Apr 03, 2012 at 03:35 AM
Eric will probably link Vectrosity at some point. You might check it out.
I'm assuming you've already checked out line renderers and decided they aren't quite up to snuff?
It looks like you might be able to set a trail renderer's fade time dynamically? I've never tried it, but coupling that with some mechanism that tracks time since player's actual drawing might have some cool potential.
`Time.timeScale` is scene-global, but might be helpful if you still want "instant" fades to look animated.
Hmm, as far as I can see (right me if I'm wrong), Vectrosity and line renders are all about straight lines. I need a modified version of the trail renderer.
That is true, but it's important to remember that most "curves" are actually rendered using a series of straight lines.
You can observe this principle in action by giving a trail renderer a very high "$$anonymous$$ vertex distance", and/or by pausing your game to check out the renderer's generated geometry. It has some very fancy interpolation features, but ultimately it is still drawing a series of straight lines.
Answer by KevinCodes4Food · Mar 02, 2015 at 10:12 PM
You can set TrailRender.time to 0 to instantly turn off trails. I have more notes on techniques in the forum thread at:
http://forum.unity3d.com/threads/can-i-pause-a-trail-renderer.141607/
Kevin