jMonkeyEngine 通过质量实现相对重力

发布于 2024-12-05 07:09:37 字数 664 浏览 11 评论 0原文

我不确定我是否正确地措辞,但是我想在JME3中设置一个类似太空的物理系统。我有BulletAppState设置和几个strigbodyControl已启用球。

    // Setting up BulletAppState
    physics = new BulletAppState();     
    getStateManager().attach(physics);
    physics.getPhysicsSpace().setGravity(Vector3f.ZERO);

    // In each sphere Geometry object I call:
    public void setPhysics(BulletAppState state, float mass) {
        rigidBodyControl = new RigidBodyControl(mass);
        addControl(rigidBodyControl);
        rigidBodyControl.setKinematic(true);
        state.getPhysicsSpace().add(this);
    }

我想根据它们的质量相互吸引这些物体(例如行星)。这是否已经在JME的Jbullet库中实现?

I'm not sure if I'm wording this correctly, but I want to set up a space-like physics system in jme3. I have the BulletAppState setup and several RigidBodyControl enabled spheres.

    // Setting up BulletAppState
    physics = new BulletAppState();     
    getStateManager().attach(physics);
    physics.getPhysicsSpace().setGravity(Vector3f.ZERO);

    // In each sphere Geometry object I call:
    public void setPhysics(BulletAppState state, float mass) {
        rigidBodyControl = new RigidBodyControl(mass);
        addControl(rigidBodyControl);
        rigidBodyControl.setKinematic(true);
        state.getPhysicsSpace().add(this);
    }

I'd like to have these objects attract each other (like planets) based on their mass. Is this already implemented in jme's jBullet library?

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

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

发布评论

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

评论(1

寒尘 2024-12-12 07:09:37

从缺乏响应和进一步搜索JME API和Web的情况来看,这在JME或Jbullet中都没有实现,我将不得不编写自己的实现。不确定我是否要这样做..

对任何有兴趣的人都不擅长数学或物理o_o,我发现了一个类似的问题,带有一些好的代码片段在这里

Judging from the lack of responses and further searching the jme API and the web, this is not implemented in either jme or jBullet, and I'll have to write my own implementation. Not sure if I'm up to that.. not to good at maths or physicses O_O

For anyone interested, I found a similar question with some good code snippet here.

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