Game Development Reference
In-Depth Information
How it works...
The graphics in this recipe are very minimalistic and mostly rely on the debug mode of
BulletAppState to draw them. The physics shapes don't normally have a visual repres-
entation since they're not part of the scene graph. Using the debug mode can be very useful
during early prototypes.
The RigidBodyControl instance of the spaceship makes sure it's affected by gravity
and other forces.
The sole purpose of a thruster is to be able to easily retrieve the position that is relative to
the spaceship from where the boosting force needs to be applied. This is why we place it at
the bottom of the spaceship. The benefit of using the Control pattern to control a
Thruster is that we can apply it to other geometries easily (and even use it in
SceneComposer ).
The fireBooster method of ThrusterControl takes the position of spaceShip
and subtracts the position of the thruster node to get the direction of the force to apply. The
relative position of the force is the direct opposite of this direction.
Search WWH ::




Custom Search