- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 Bullet 以及所有 3D 和物理学方面的新手,所以不要生气 :)我需要创建一个大的静态刚性球体和一个小的动态球体。我想像瓶子一样使用大的,所以小球体可以在里面移动,但不能离开球体,除了顶部的一个。我在 Blender 中编写了 2 个模型(当然我在大球体上打了一个洞),创建了一个世界并在里面放置了物体。但是当我启动应用程序时,小球体以极快的速度从大球体中抛出。如果有帮助,我还会将 Bullet 与适用于 Android 的 GDX 库一起使用。
此代码初始化世界。
public final btCollisionConfiguration collisionConfiguration;
public final btCollisionDispatcher dispatcher;
public final btBroadphaseInterface broadphase;
public final btConstraintSolver solver;
public final btCollisionWorld collisionWorld;
public PerformanceCounter performanceCounter;
public final Vector3 gravity;
public int maxSubSteps = 5;
public World() {
Vector3 gravity = new Vector3(0, -10, 0);
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
broadphase = new btDbvtBroadphase();
solver = new btSequentialImpulseConstraintSolver();
collisionWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
((btDynamicsWorld)collisionWorld).setGravity(gravity);
this.gravity = gravity;
}
还有一些创建大球体的代码
final StillModel sphereS = ModelLoaderRegistry.loadStillModel(Gdx.files.internal("data/Ssphere.obj"));
sphereS.subMeshes[0].getMesh().scale(3f, 3f, 3f);
final BoundingBox sphereSBounds = new BoundingBox();
sphereS.getBoundingBox(sphereSBounds);
final Constructor sphereSConstructor = new Constructor(sphereS, 0f, new btSphereShape(sphereSBounds.getDimensions().x));
sphereSConstructor.bodyInfo.setM_restitution(1f);
world.addConstructor("sphereS", sphereSConstructor);
一个小球体的代码
final StillModel sphereModel = ModelLoaderRegistry.loadStillModel(Gdx.files.internal("data/sphere.obj"));
sphereModel.subMeshes[0].getMesh().scale(0.8f, 0.8f, 0.8f);
final BoundingBox sphereBounds = new BoundingBox();
sphereModel.getBoundingBox(sphereBounds);
final Constructor sphereConstructor = new Constructor(sphereModel, 0.25f, new btSphereShape(sphereBounds.getDimensions().x * 0.5f));
sphereConstructor.bodyInfo.setM_restitution(1f);
world.addConstructor("sphere", sphereConstructor);
构造函数类只是创建 btRigidBodyConstructionInfo 和 btCollisionShape 对象,构造球体并将其放置在世界中。
那么,你能告诉我如何创建一个里面有球的空球体吗?
附言请不要告诉我谷歌,我已经完成了
P.P.S 对不起我的英语
最佳答案
因为你的大球体不是凸的,你不应该为它使用 btSphereShape。您可以尝试 btBvhTriangleMeshShape,或其他一些非凸形状。
构造起来有点复杂,但是看一些例子可能会提供思路。无论如何,没有简单的方法可以得到你想要的东西,因为它甚至不是一个普通的空球体(我认为你使用的 libgdx 框架只采用你的 sphereS 模型进行渲染)。
关于android - 使用 Bullet 在球体内的球,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16651089/
因此,我的flutter应用程序运行正常,但是我想对其进行一些更改。 我要执行的第一个更改是创建一个水平滚动窗口小部件,该窗口小部件的图像可以单击以更改工作站。 但是要做到这一点,我首先需要将两个小部
如何在 Bootstrap 模态的主体内设置 div 样式?这是我的模型: text ') .okBtn('ok') .open();">Open Model 我的CSS: @M
我有一个简单的触发器,它在 SQL Fiddle 上运行,但它不允许我将 INSERT STATEMENT 移动到触发器的主体内。 my code on sqlFiddle我只是想移动这条线 INSE
我是一名优秀的程序员,十分优秀!