trail implement

Started by
3 comments, last by Runoo 14 years, 5 months ago
Hi, I just implement a trail attach to a sword, but it is not smooth when sword changing position quickly. I wonder how to achieve this kind of smooth in this video:
Any suggestion? Thank you!
Advertisement
Haven't tried it, but a guess: each frame, calculate the worldspace position of some points on the sword (the top and bottom for instance), and save these in a list; then, draw trails by connecting those points.
Quote:but it is not smooth when sword changing position quickly.

To address this specifically... If a sword swing takes 1/2 of a second and the game is running at 30 fps then that swing only lasts 15 frames. If you are generating only one new point per frame for the trail then it may look jagged. Have you tried you taking multiple, interpolated samples each frame?
Quote:Original post by gzboli
Quote:but it is not smooth when sword changing position quickly.

To address this specifically... If a sword swing takes 1/2 of a second and the game is running at 30 fps then that swing only lasts 15 frames. If you are generating only one new point per frame for the trail then it may look jagged. Have you tried you taking multiple, interpolated samples each frame?


Yep, you can update your animation at a higher frequency than your frame rate to find intermediate points or you can pass a spline through the top and bottom set of points and find intermediate points that way. Running the animation at a higher frequency is likely to be higher quality but more CPU intensive.

I would recommend using a catmull rom spline as this passes through all the points generated by the animation. You will have to duplicate the current time point in order that the trail actually reaches the current frame.

http://www.mvps.org/directx/articles/catmull/

Cheers,
Martin
Cheers,MartinIf I've helped you, a rating++ would be appreciated
Quote:Original post by Martin

I would recommend using a catmull rom spline as this passes through all the points generated by the animation. You will have to duplicate the current time point in order that the trail actually reaches the current frame.



Thank you all!
I will try using catmull rom curve to implement the trail effect.

This topic is closed to new replies.

Advertisement