Chapter 8. Physics with Bullet

This chapter contains the following recipes:

  • Creating a pushable door
  • Building a rocket engine
  • Ballistic projectiles and arrows
  • Handling multiple gravity sources
  • Self-balancing using RotationalLimitMotors
  • The principles of a bridge-building game
  • Networked physics

Introduction

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.

Note

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.236.70