简体   繁体   中英

how to simulate 2d water surface?

I'm making a game and i want to have a water in it. Physically it is simulated just as a static shape sensor which is applying some forces to the bodies in it. But how can i simulate the surface of the water ? I want to be able for example to provide some waves, when some body falls in the water. Thanks

You might want to have a look at Cem Yuksel's work on wave particles , as well as the references included in his paper. Or Google for "Shallow Water Equations". There have been several implementations for real-time use. There might also be a couple of useful links here .

I'm not sure which language you are using, but you should probably use a physics engine like Box2D. It's written in C/C++, but has been ported to many different languages like Actionscript. You can set stuff like buoyancy, density, etc. to simulate the water and the objects falling into it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM