UnrealScript Game Programming Cookbook

(Chris Devlin) #1
Chapter 3

73


  1. Remember when we hid our pawn from view before? Well this time we're
    going to allow the pawn to be shown, but hide our first person weapon:
    Pawn = Pawn(OutVT.Target);
    if (Pawn != None)
    {
    /* Hide the pawn's "extra" weapon /
    if(Pawn.Weapon != none)
    {
    Pawn.Weapon.SetHidden(true);
    }
    }


There are a number of reasons as to why we do this, most notably, due to the fact
that designers want to limit the detail of the weapons and pawns as the camera gets
further away. There's no reason to have a high poly model present if the player never
sees it. This allows better graphical efficiency as the distance between the pawn or
weapon increases.


  1. In our first person camera we used the pawn's eyes as the socket point from which
    our offset would be based. This time however, we're going to be using the weapon's
    socket, simply titled WeaponSocket.
    /**

    • If you know the name of the bone socket you want to use,

    • then replace 'WeaponPoint' with yours.

    • Otherwise, just use the Pawn's eye view point as your
      starting point.
      **/
      /socket not found, use the other way of updating vectors
      /
      if (Pawn.Mesh.GetSocketWorldLocationAndRotation
      ('WeaponPoint',OutVT.POV.Location, OutVT.POV.Rotation) == false)
      {
      /Start the camera location from the target eye
      view point
      /
      OutVT.Target.GetActorEyesViewPoint
      (OutVT.POV.Location, OutVT.POV.Rotation);
      }



Free download pdf