tags:

views:

269

answers:

2

I have implement one game application .In that game i want to implement wateer animation.PLease give me idea about that.

same like:http://www.heikobehrens.net/2009/10/02/burlington-ducky-iphone-app/

+6  A: 

Use the code here as a starting point.

Marcelo Cantos
I want to implement in iphone not for java.
MD
...then start translating the algorithm. This is not a site to have other people write your code, but a site to get help and guidance. You should mark this as the correct answer.
coneybeare
+5  A: 

Sure, easily done. Start by solving the Wave Equation in two dimensions:

http://en.wikipedia.org/wiki/Wave_equation

Then write a program that uses the simulated wave to distort the image.

UPDATE: kvb points out that this might be rather more work than necessary, and now that I think about it a bit more, it probably is. Rather than solving the wave equation analytically, you could instead write a simple physics engine that simulates the surface in some other way. For example, you could represent the surface as a flat grid of points where each point is connected to its neighbours by springs. The physics of springs are easy to simulate; you just make a restoring force proportional to the deflection of the spring. Make sure to add a damping effect so that the system settles down eventually. Moving one of the points above the plane and stretching its springs should send ripples out through the mesh.

Eric Lippert
Something tells me that "All you have to do is..." is perhaps an understatement. For instance, it doesn't exactly address the whole displaying an animation part... And yet, this answer is voted up over an answer which actually links to relevant code!
kvb
@kvb: there, is that better? The poster asked for ideas, I gave them ideas.
Eric Lippert
Don't get me wrong - I enjoy your glib answers. In this case, though, I think the poster might need a bit more to go on than just a link to a page rife with partial differential equations, and "easily done" might belie the implementation effort.
kvb