Add Trails to Meshes
CreatiCode last edited by creaticodeta2-mail
Sometimes we have objects that move really fast, such as a ball or a bullet. We can add trails to such objects to show their moving paths.
Note that the trail is thicker at its head, and it gradually shrinks in width until it disappears at its tail.
The “add trail” block adds a new trail to the current sprite object selected for the current sprite. Let’s refer to that object as the “target object”.
You can set these 2 colors to the trail mesh, just like how you update the color of a box. Note that often we want to make the tail glow some lights, so the emission color will be used to set the color of the glow.
This value controls the width of the trail at its head (the thickest point). Note that the trail will be drawn with the same width at its head no matter from which angle our camera is looking at it.
This value controls the length of the trail indirectly. Each segment corresponds to one of the previous positions of the target object. If the Segments value is 50, then the trail will be drawn along a path that connects all the past 50 segments. So when the target object is moving faster, the distance between the segments will be longer.
In this demo, a sphere moves left and right repeatedly, and a trail is added to show its path.
In the program, there are 2 places worth mentioning.
- To make the trail glow colors, we need to add the trail itself to the glow layer, not the target object for the trail.
- After adding the trail, it becomes the sprite object itself. So to make the original target object “s” to move left and right, we need to select that object first.
Try it yourself here: