-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
JMonkeyEngine 3.0 Cookbook
By :
There are several ways to perform firing, and the requirements depend heavily on the type of game. This recipe will start off with the basics, which can then be extended to support the different forms of firing. We'll create the necessary functionalities to fire instant bullets; they are performance-friendly and suitable for a fairly close-quarters FPS.
This example will be based on GameCharacterControl and InputAppState from the Creating a reusable character control and Attaching an input AppState object recipes of this chapter, respectively. Familiarity with the recipes is beneficial. Further, we'll use the Ray class in combination with CollisionResults to check whether the bullet has hit anything or not.
Rays can be imagined as infinite lines and are very common in game development. This is a fast way of detecting intersections with game objects and is thus suitable for instant firing. The targets might consist of any kind of spatial. In this case, it's a bunch...
Change the font size
Change margin width
Change background colour