Game Development Reference
In-Depth Information
Using the if (HitActor.IsA()) statement, we can place our
bounding box around any actor in UDK. Replace 'Pawn' with any
actor class of your choice to do this.
4.
Now that our RenderBoundingBox() function is called, let's take a look at what
it actually does.
/*****************************************************************
* Draws brackets around an actor, based on bounding box
* coordinates
*****************************************************************/
function RenderBoundingBox(Actor Actor)
{
local Box ActorBB;
local int ActualWidth, ActualHeight;
/** If we don't have a canvas to draw on or are
targeting an actor, get out */
if (Canvas == None || Actor == None)
{
return;
}
We pass in our Actor parameter that we did a trace on. We have three parameters
here: one Box variable, that is, ActorBB , which represents the bounding box around
our actor, along with ActualHeight and ActualWidth , which measure the
dimensions of the box.
As always, we need to have a check. This time we're verifying that we have a canvas
to draw on in addition to an actor available to us. If either of those are not present,
then we get out of the function.
5.
We need a bounding box for our actor now, so we set our ActorBB variable to be
set to the function GetBB , while passing in our Actor parameter. We'll get to know
exactly how this function works shortly, but it's going to determine how far from the
pawn the box should reside.
/** Grabs the bounding box around our selected actor */
ActorBB = GetBB(Actor);
/** Math for the height and width */
/** Change the float to adjust whether there are spaces
between lines */
 
Search Nedrilad ::




Custom Search