You know how in rpg games your character swings his weapons and a glowing trail shows up behind it?
I figured out an efficient way to create that effect.
This code records the positions of two points on the sword. I make one recording at frame X and one at frame X + 1. This give me four points. However, instead of just creating one plane and using vertexdata commands to adjust the position of the 4 vertexes to match the four points, I take it one step further. Because this algorithm only produces one trail segment per frame, I was wondering...
Using algorithms to find the intersection (or closest points) of two 3D lines, I was able to divide segments into 4 parts. Thus, when the sword swung fast, I could still have a relatively smooth trail.
Using this method, I could conform trails to match any motion of the sword, even rotation around the tip of the blade. In addition, I could up the level of detail by doing some clever copying and pasting.
No particles needed.
What do you guys think?
pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342177067... and yet I still have a life.