Jump to content
  • Advertisement
Sign in to follow this  

trail implement

This topic is 3120 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!