简体   繁体   English

如何模拟二维水面?

[英]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. 您可能想看看Cem Yuksel在波浪粒子方面的工作,以及他的论文中包含的参考文献。 Or Google for "Shallow Water Equations". 或Google的“浅水方程式”。 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. 我不确定您使用的是哪种语言,但是您可能应该使用Box2D之类的物理引擎。 It's written in C/C++, but has been ported to many different languages like Actionscript. 它是用C / C ++编写的,但已移植到许多不同的语言,例如Actionscript。 You can set stuff like buoyancy, density, etc. to simulate the water and the objects falling into it. 您可以设置诸如浮力,密度等内容,以模拟水和掉入其中的物体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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