问题标签 [bulletphysics]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
2185 浏览

build - Bullet Physics,CMake-> CodeBlocks - MinGW:找不到 GL/glut.h?

统计数据...

我的系统:Windows Vista 64 位

图书馆:子弹物理 v2.78

Makefile 生成器:CMake

构建系统:MinGW 命令行,MinGW + CodeBlocks

Makefiles 是通过命令行和 CMake 生成的 Code::Blocks 项目实现的

在这两种情况下,构建失败率接近 30%。注意:我确实必须将 Code::Blocks 项目中的构建可执行文件从 make.exe 切换到 mingw32-make.exe

第一次失败:Demos\OpenGL\GLDebugFont.cpp -> GL/glut.h: No such file or directory

第二次失败(在第一次注释掉#include 之后)-> Demos/OpenGL/GlutStuff.h:同样的错误

这些失败发生在我构建命令行或通过生成的 C::B 项目时。

为什么找不到 GL/glut.h?“bullet-2.78\Glut\GL\glut.h”存在。也许有一种方法可以告诉它在那里找到过剩?

注意:在 CMake makefile 生成期间,CMake 确实告诉我“您使用的是过时的 GLU 包,请改用 OpenGL。” 它继续正常生成 Makefile。也许我需要定义一些环境变量?也许我需要在 Windows 中配置 CMake 正在寻找的东西?

我会在 bullet-2.78/Glut 中添加编译器搜索路径,但如果您使用自定义 makefile(如 CMake 生成的文件),Code::Blocks 不允许这样做。

更新:我已经能够通过在 Code::Blocks 项目中构建特定目标来构建库本身。但是,我无法构建任何演示或基准测试,因为它们都使用 OpenGL(并且显然是 glut.h)。我仍然想编译这些。

0 投票
2 回答
1439 浏览

physics-engine - Bullet Physics MultiSphereShape Usage

  1. I am posting here because I have not been successful in finding a helpful answer either directly on the Bullet Physics forum or any of those associated forums which have either ported the library [JBullet, BulletCS] or incorporated it in their own product [Blender, Panda3d]. Here it seems, at least if I can ask the question properly, the odds seem best of getting a helpful reply.

  2. I want to simulate the rolling of dice. All the examples I can find seem content with using a Box shape. Mine is an interest in children's games, not Las Vegas. The defining difference, at least in my application, is that the dice [whether 6-sided, or something else, but let's just stick with 6-sided here] have 'kinder-gentler' rounded edges with no pointed corners.

  3. It seems that btMultiSphereShape would be just perfect for me -- me being someone who does not have the knowledge to construct any complex shape from lower-level primitives, me being someone who hopes to use what is already built into the collision intelligence of the Bullet engine, not someone trying to engineer any new, exotic behavior.

  4. With that preface I would really appreciate a succinct example of:

    a. how to pass the arguments to the btMultiSphhereShape constructor; b. how to configure the transform that needs to be passed to btDefaultMaotionState; and c. how to set the localInertia.

  5. I understand that this is a general-purpose library with classes that can support almost anything, but please, for a beginner, instead of discussions of those very nice attributes of a well-conceived toolkit, what would be most helpful to me [and I believe to many other users] would be a clear example of supplying those key properties to the necessary classes and methods to these specifics:

    a. a six-sided die with equal dimensions, let's make the rounded cube about 2cm per side; b. let's have the radius of the 'corners' a gentle 0.1.cm.

  6. Now, one more request, please. In order to observe the behavior of the die beginning with a simple 'drop', taking into account only forces due to gravity, please suggest a transform that will result in some kind of interesting tumbling result from a collision against the usual 'floor' example; in other words, it should impact the floor on a rounded corner.

0 投票
1 回答
901 浏览

box2d - 我在哪里可以找到不同材料的夹具预设?

我在哪里可以找到可以在刚体物理引擎中使用的夹具预设,比如Box2D来模拟不同材料的行为?

我正在寻找常见材料的密度、摩擦和恢复值,例如:

  • 光滑/粗糙的金属
  • 木头
  • 橡胶
  • 塑料

除了尝试和错误设置这些值以实现实际结果之外,还有其他方法吗?

0 投票
2 回答
8986 浏览

c++ - 检测与子弹的碰撞

我用 Ogre3D 制作了一个应用程序,已经生成了子弹的对象,我现在需要的只是检测对象之间的碰撞。

我查看了 CollisionInterfaceDemo 演示,它并不真正符合我的需求。

检测3个球体之间的碰撞所需的步骤是什么,只知道它是否发生碰撞(我不关心碰撞点)?

我只知道我可以通过设置它的变换来移动一个 CollisionObject。

0 投票
1 回答
43 浏览

c++ - GIM_TRIANGLE::is_point_inside 错误(子弹物理)

is_point_inside传递上述值时返回 true。它不应该返回false吗?

0 投票
1 回答
953 浏览

c++ - 如何在 Bullet Physics 中设置柔体的位置

我正在尝试将软体的运动锁定到 x 轴。我希望能够左右移动,但将其锁定在 z 轴的相同位置。

即使当我沿 x 轴应用速度时,由于空气阻力和我假设的软体移动方式,有时也会导致身体在 z 轴上向后移动。

为了解决这个问题,我想使用刻度回调来确保柔体的 z 位置始终为 0;

这是最好的方法吗?如果是,我该如何设置位置。

我已经尝试过 .transform() 和 .translate() 但没有设法让它工作。

谢谢。

0 投票
0 回答
803 浏览

memory-management - Bullet Physics 内存在具有许多三角形网格的大型变化世界中使用

btDiscreteDynamicsWorld 是否可以从整个 DynamicsWorld 重新创建/扩展它自己的八叉树/SpatialHash 并随着我从 (0,0,0) 增加添加对象的距离而继续扩展它?例如,向八叉树添加一个新的顶层,从而使用更多的内存并且永远不会再次缩小它?

我使用包含多个 btBvhTriangleMeshShape 对象的 btDiscreteDynamicsWorld 进行静态碰撞。还有一些其他原始实体(btBoxes 和 btCylinders)与静态三角形网格碰撞。我不断地将“动作点”从 DynamicsWorld 的原点 (0,0,0) 移开,移除旧的 TriangleMeshes 和旧的原始实体,同时以相同的方式添加新实体。(程序生成的世界)当我继续沿 x 轴移动时,内存使用量不断增加。但是当我在某个点停下来并回到我来的路上,再次删除和添加新形状时,内存使用保持不变。

在通过从我的堆中正确添加和删除(也删除)碰撞对象(如手动删除 MotionStates 等)来寻找可能的内存泄漏之后,我仍然面临这种行为。

子弹的技术文档不是很详细,浏览子弹的源代码也没有给我任何线索。API 没有显示类似 recalcOctree() 函数的内容。

我可以在不删除整个 btDynamicsWorld 对象的情况下强制重新计算内部碰撞结构吗?还是我在这里完全走错了路?与原点附近的对象相比,在添加远离 (0,0,0) 的对象时,是否有其他人经历过子弹中的内存使用量增加?

我使用子弹 2.79

0 投票
1 回答
1784 浏览

c++ - 在 Qt 中集成一个 Bullet 简单演示

我想将 Bullet 演示集成到 Qt 应用程序中。我正在使用 Bullet 附带的 Bullet 演示示例,称为 App_BasicDemo。

如果我在没有 Qt 的情况下执行这个应用程序,它会打开一个窗口并且渲染得非常好。所以我想,如果我只是把它作为一个 QGLWidget,它应该在 Qt 窗口中做同样的事情。但它不起作用。

在我的 GLWidget 的构造函数中,我创建了 BasicDemo。在 initializeGL 中,我调用了 BasicDemo 的 myinit 和 initPhysics。最后,在paintGL 中,我调用clientMoveAndDisplay。

我遇到的第一个问题是调用 swapBuffers 时 clientMoveAndDisplay 会崩溃。

如果我只是评论该行,程序不会崩溃,但它不会显示任何内容。

我错过了什么?

编辑:

编辑2:

好的,我想我得到了答案。当我初始化 openGL 时,我必须重塑一次 Demo,因为 Bullet 需要我的小部件的宽度和高度。我想这是在之前的一些 Bullet 方法中完成的,当时它叫做 glutmain ......

场景->重塑(这个->宽度,这个->高度);

成功了。现在我可以看到我的 Bullet Demo。(它不会像在独立的 Bullet 应用程序中那样得到更新,但这是另一个问题)

无论如何,谢谢马丁贝克特!

0 投票
5 回答
2348 浏览

game-engine - 智能手机上的子弹物理?(安卓 / iPhone)

这可以在智能手机(Android / iPhone)上实现吗?我认为这叫做子弹物理。

我的意思是在应用程序中实时。用户设置球,然后爆炸/破坏。

一定不能那么完美。简单的颜色。只有物理是重要的。

只有爆炸/破坏对我来说很重要。

视频 1

视频 2

0 投票
1 回答
1071 浏览

orientation - 使用 Bullet 和 Ogre3D 平滑旋转

在我使用 Ogre3D 和 Bullet 物理实现的游戏中,我一直遇到一个关于实现角色定向的问题。

我所拥有的:角色正在移动的方向向量,以及它的当前方向。

我需要什么:设置角色的方向以面对它移动的方式。

我有一段代码可以满足我的要求:

“body”是我要定位的刚体。

然而,这个片段有几个问题:

1)当改变方向时,它往往会“抖动”,即它迅速面向一个方向,然后在将自己校正到它应该处于的方向之前大约一秒钟左右。

2) 大多数时候,代码运行时,我从 Bullet 的 btQuaternion 得到一个断言错误
assert(d != btScalar(0.0));

任何人都可以帮忙吗?

谢谢!