This chapter contains the following recipes:
Using physics in games has become very common and accessible, thanks to open source physics engines, such as Bullet. jMonkeyEngine supports both the Java-based jBullet and native Bullet in a seamless manner.
jBullet is a Java-based library with JNI bindings to the original Bullet based on C++. jMonkeyEngine is supplied with both of these, and they can be used interchangeably by replacing the libraries in the classpath. No coding change is required. Use jme3-libraries-physics
for the implementation of jBullet and jme3-libraries-physics-native
for Bullet. In general, Bullet is considered to be faster and is full featured.
Physics can be used for almost anything in games, from tin cans that can be kicked around to character animation systems. In this chapter, we'll try to reflect the diversity of these implementations.
All the recipes in this chapter will require you to have a BulletAppState
class in the application. To avoid repetition, the process of doing this is described in the Adding Bullet physics to the application section in Appendix, Information Fragments.
18.119.111.179