2
\$\begingroup\$

I am new at game development want to know that how can I implement bullet physics in libgdx. I searched lot of things on Internet but nothing found worthy.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ This question is a bit overbroad for our format. \$\endgroup\$ Commented Mar 9, 2013 at 5:44
  • \$\begingroup\$ After studying the links given by Mr. Cameron Fredman I understand the basics of bullet physics but still in dilemma that how can i implement bullet physics in 2d game built in libgdx platform. I need some kind of sample code or tutorial which help me. \$\endgroup\$ Commented Apr 2, 2013 at 7:40
  • \$\begingroup\$ @NishantAnindya I know I'm like 2 years late, but for documentating purposes: for 2D games, use Box2D, it's a lot simpler and enough for 2D physics. Let Bullet only for your 3D games. \$\endgroup\$ Commented Sep 5, 2015 at 3:24

1 Answer 1

2
\$\begingroup\$

As I mentioned in my comment above, this question is a bit overbroad, but here's the source code for the JNI bullet engine in libgdx. And here's the wiki. The Bullet User Manual is a pdf file located in the root of the Bullet Physics SDK, which might make a good place to start.

You'll need to add gdx-bullet.jar and gdx-bullet-natives.jar to your desktop project, and gdx-bullet.jar to your Android project. You’ll also need to copy the libgdx-bullet.so files from the extensions/gdx-bullet/armeabi and armeabi-v7a folders to your Android project’s libs/armeabi and armeabi-v7a folders of course.

And there's this from the google codebase:

Setting up Bullet with libgdx To use bullet physics in your project, you’ll need to add gdx-bullet.jar to your main project. Alternatively you can add the gdx-bullet project to the projects of the build path of your main project.

For your desktop project you’ll need to add the gdx-bullet-natives.jar to the libraries.

For your android project you’ll need to copy the armeabi/libgdx-bullet.so and armeabi-v7a/libgdx-bullet.so files to the libs folder in your android project.

Bullet isn’t supported for GWT at the moment.

Initializing Bullet Before you can use Bullet, you’ll need to load the libraries. This can be done by adding the following line in your create method:

Bullet.init();

There's a good deal more information at the links provided above.

\$\endgroup\$
1
  • \$\begingroup\$ I'd add for anyone that finds this that Xoppa has some great tutroials. \$\endgroup\$ Commented Mar 27, 2015 at 11:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .