我正在使用LibGDX游戏引擎创建2D游戏,并使用box2d进行物理模拟。如何检测碰撞?是否有类似于box2d适用于3D游戏的解决方案?
我正在使用LibGDX游戏引擎创建2D游戏,并使用box2d进行物理模拟。如何检测碰撞?是否有类似于box2d适用于3D游戏的解决方案?
是否有像Box2d一样的用于3D游戏的物理引擎?
是的。在libgdx中有一个名为Bullet的3D物理引擎。它是用C和C++编写的,使用一个包装器来使其能够从Java中进行通信。
要将其添加到您的项目中,您必须将以下内容添加到位于项目根目录中的gradle.build文件中:
核心依赖项:
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
桌面依赖:
compile "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-desktop"
Android依赖项:
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"
iOS依赖性:
compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-ios"
HTML 依赖不兼容!
如何使用它创建游戏是一个非常广泛的问题。看一下这个: