Integrating direct.motiontrails into Particle Effects

I have a simple particle effect just having sprites moving up. Is there an easy way to give them motion trails? My current thought process was to somehow grab the geometry that the sprite is generating and attach a trail like that, but how expensive is that?..and is there a built-in approach before I continue researching?

Have you looked at the “Motion Trails” samples? I believe that there are two, one showing a geometry-based approach and the other showing a framebuffer-based approach. Those might provide some inspiration!

I appreciate your response :slight_smile: I totally forgot that sample was there–awesome, thanks! I ended up trying this a few hours ago but I couldn’t exactly figure out how to “grab the geometry that the sprite is generating” from Panda’s built-in particle system.

I’m trying to put a trail on every individual particle that is being emitted. My current thought process was:

def createMotionTrail(np):
    fire_trail = MotionTrail("fire trail", np)
    fire_trail.time_window = 3 # Length of trail
    fire_trail.add_vertex(Point3(0, 0, 1))
    fire_trail.add_vertex(Point3(0, 0,-1))
    fire_trail.set_vertex_color(0, flame_colors[0], flame_colors[0])
    fire_trail.set_vertex_color(1, flame_colors[1], flame_colors[1])

for particle in particleEffect.particlesDict.values():

But I think particle.nodePath is something way different than what I’m trying to do :stuck_out_tongue:

Hmm… I’m afraid that I don’t know enough about the MotionTrail class or the internals of Panda’s particle system to really have a useful comment, I fear.

I will say that the framebuffer approach (as shown in the non-MotionTrail sample) should work–although it of course won’t produce the same effect!

1 Like

Will definitely try that next. Thanks!!

1 Like

it seems like this Rapidly-Moving Objects — Panda3D Manual
Visualizing the previous transform mabye help you get inspiration,you’d better write a test to make sure it’s what you need