Algorithm to swim like a fish in c#
I need to implement a feature in my application where these words are going to "swim" around in the background, basically I need to pick a point in front of the leading letter of the word, and swim to it using a "wavey" style.
I a开发者_JAVA技巧lso need to avoid the walls, so it turns in time, among other 'fish like' behaviors it needs to implement.
I'm sure I need to do something with a sin
calculation, but I really want it to be efficient, I'm using C#, but any language implementation will be insightful.
What resources are out there for implementing this in C#?
one classic flocking simulation you could take a look at would be Boids
I've done something vaguely similar, where a series of letters animates based on the movement of the leading letter. It is mouse trailing, and not so much fish swimming, but the approach could be made to work as the positional offset decays as a function of the distance from the leading character.
It's MFC/C++ and is located on codeproject.
精彩评论