Game Development Reference
In-Depth Information
Drawing a bounding box around pawns
If you've ever played Eidos' excellent Deux Ex before, then you should be very familiar with
bounding boxes around objects that your character is facing. We're going to replicate the
same effect, but just for pawns. It's easy to alter and add functionality, however, so we really
could draw a bounding box around nearly any object in the game.
This is great for highlighting objects that you want to point out to the player, or entice them to
perform an action, such as pick up an object.
Getting ready
Start by having your IDE open and ready to make some changes. We won't have to create any
new classes, as we'll only have to make changes to an existing function in our TestHUD class.
How to do it...
We need to use a trace to detect whether or not a pawn is standing in front of our
character. Because invisible actors (that is, objects which don't use a sprite or something
we can actually see on screen) may still block our path, we use TraceActors to determine
what's in front of us.
Search Nedrilad ::

Custom Search