Game Development Reference
In-Depth Information
Start off by declaring a variable to reference our WeaponFlashlight .
var WeaponFlashlight Flashlight;
We also need to add some functionality in our PostBeginPlay() function:
simulated event PostBeginPlay()
'Log("Tutorial Pawn up");
//***** Used for the flashlight *****//
// Spawns the light on the player, setting self as owner
Flashlight = Spawn(class'WeaponFlashlight', self);
// Sets the lights base on at the player
// Light is off by default
// Starts at 75% brightness
We're doing a few things here. First, we're spawning our WeaponFlashlight and
setting our pawn as the owner. Afterwards, we're attaching the light to our pawn,
keeping it toggled to off by default, and dropping the brightness down to 75 percent.
4. The flashlight is attached to our pawn, but we need it to rotate when our pawn
rotates, so let's do that now:
* Forces the flashlight to use our pawn's rotation
event UpdateEyeHeight( float DeltaTime )
// Flaslight will use our controller's rotation
/* Offset the light slightly, so that it looks as
though it is coming from our pawn's eyes/helmet */
(Controller.RelativeLocation + vect(20, 0, 25));
Search Nedrilad ::

Custom Search