Object leaving a trail behind

  • Kiro Neptosia

    Kiro Neptosia - 2017-01-08

    Does anyone have a good idea how to make a particle that leaves a trail behind as it moves? That is to say the trajectory of the particle is made visible as it moves.

  • Pete

    Pete - 2017-01-08


    There was a somewhat similar question about a year and a half ago: https://sourceforge.net/p/aoi/discussion/47783/thread/4422320d/. I don't know if that approach would work for you or if you'd like something more ... ehhh .. techincal?

    I had a couple of (more complex) ideas but I missed the conversation at the time, so a couple of questions:

    • Should it look like a line or a tube drawn, where your object is moving or would you prefer a trail of objects left behind?
    • Is the trail supposed to start to disappear after a moment or is it supposed to be permanent?
    • Your particle does not happen to be an actor, that moves it's arms and legs while moving? ;)

    All these (I think) can be done by scripting and involve the basic steps that first you make the animation of the object and then use a script to create a trail, that becomes visible as the object moves in time.

    The script could then (for example) make live duplicates of the object and utilize the Visibility track to turn each copy visible at the right time. -- Transparent texrures might come in handy here.

  • Luke S

    Luke S - 2017-01-08

    The exact method will depend on few things

    What do you want your trail to look like? A solid line will need to be handled differently from series of sparks. Should the trail extend back along the entire trajectory of should it fade over time or distance?

    If the trail is very complex, or if you have a lot of them, you might even need to look into scripting. we'll be glad to help with the details

  • Pete

    Pete - 2017-01-08

    It seems that Luke answered the same time I did.. :)

    Anyway, I have had this somewhere in the back of my mind for a while now, so I decided to give it a try. The script and the example file should pretty much explain themselves....

    This is now a tool script that adds trailing objects into the scene -- this of course has any use only if you'd like to animate the trailing objects/particles after they are drawn.

    Most likely this would work better as a scripted object, that generates the trail for every rendered frame based on the recent movements of the given object to trail. By using a scripted object it would also be easier to draw the trail as a line (a tube object really) and have it gradually fade away, if needed.

    Last edit: Pete 2017-01-08
  • Pete

    Pete - 2017-01-08

    And here is a prototype for the Scripted Object kind of a trail.

    This one only draws spehers as the trail but basically it is possible to use the information to draw a "ribbon" of some kind and use per vertex mapping and parameters for the texture to make the tail "go old" or disappear etc....

    The sripted object approach is probably nicer to use but requires a bit more work as (AFAIK) there is no ready getCoords(double time)-method and the script can not sent the scene back in time to do the math. Instead you have to dig the information from the animation tracks.

    Last edit: Pete 2017-01-08
  • Kiro Neptosia

    Kiro Neptosia - 2017-01-11

    Thank you so much, Pete! Your scripted object is exactly what I needed.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks