javascript 有水物理引擎吗?

发布于 2024-11-16 01:33:06 字数 207 浏览 10 评论 0原文

我想使用 javascript 和 制作一个演示,我正在考虑做一个小移动生物,从顶部看并在水环境中游泳。

“艺术”概念: 在此处输入图像描述

我可以使用某些东西来启动此项目,还是需要从头开始创建所有内容?

I want to make a demo using javascript and <canvas>, I was thinking of doing a little moving creature, seen from the top and swimming in a water environment.

Concept "art" :
enter image description here

Is there something I can use to start this project, or do I need to create everything from scratch ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

看春风乍起 2024-11-23 01:33:06

http://rumpetroll.com/ 是开源的,并且具有您可以根据需要进行修改的运动类型

http://rumpetroll.com/ is open source and has the kind of movement you could probably modify to do as you wanted

两相知 2024-11-23 01:33:06

我不确定你到底想模拟什么(或者我是否得到了概念艺术:)),但这可能是一个方向:
processing.js 不是物理引擎,而是 javascript 的图形库端口(利用画布) - http://processingjs.org/
但是,您可能会在他们的演示中找到与您尝试创建的内容类似的内容。

原始处理库示例之一使用粒子系统进行了很好的流体模拟,并且它在processing.js上成功运行 - http://processing.org/learning/topics/fluid.html,但是帧率非常差。您可以在 http://processingjs.org/learning/ide 亲自尝试 - 只需复制并粘贴示例中的代码(并为您的计算机爬行停止做好准备)。

您可以尝试调整粒子数 (pnum),以提高速度,并尝试使用其他变量。

I'm not sure what exactly do you intend to simulate (or whether I got the conceptual art :) ), but this might be a direction:
processing.js is not a physics engine, but rather a graphics library port to javascript (utilizing canvas) - http://processingjs.org/ .
However, you might find something in their demos that is similiar to what you are trying to create.

One of the original processing library examples has a nice fluid simulation using a particle system, and it runssuccessfully on processing.js - http://processing.org/learning/topics/fluid.html , however the framerate is very poor. You can try it yourself at http://processingjs.org/learning/ide - just copy&paste the code from the example (and prepare for your computer to crawl to a halt).

You can try to adjust the particle numbers (pnum), to improve speed, and play around with other variables.

快乐很简单 2024-11-23 01:33:06

抱歉,我不知道图书馆,但我最近确实在画布演示中看到了水物理:

http://hakim.se/experiments/html5/wave/03/

也许你可以在那里得到一些灵感...你也许可以使用像 Box2DJS 这样的普通 JS 物理库来完成它。

Sorry I don't know of a library, but I did see a water physics in canvas demo recently:

http://hakim.se/experiments/html5/wave/03/

Maybe you can get some inspiration there...you might be able to accomplish it with a normal JS physics library like Box2DJS.

洒一地阳光 2024-11-23 01:33:06

只是一个想法,但您可以搜索 Java 引擎,然后使用 GWT 将其编译为 Javascript。

Just an idea, but you could search for a Java engine and then use GWT to compile it to Javascript.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文