Game Development Reference
In-Depth Information
PotentialCameraLocation is where we actually want the camera to be.
The HitLocation and HitNormal variables are used for our trace.
This comes into play when our camera bumps into a wall, and rather than
clipping through the wall, allows the camera to be offset, so that it still
displays our pawn without interrupting the gameplay experience.
Finally, the HitActor variable declares what we've just hit when doing
our trace.
5.
If we know which pawn socket name we'd like to use, then declare it, otherwise
we'll use the pawn's eyes as our default starting point for what we see (that is,
we draw our viewpoint from where the weapon is pointing instead, using the
WeaponSocket socket):
/** Our pawn will be where we are grabbing our
perspective from */
Pawn = Pawn(OutVT.Target);
/** If our pawn is alive*/
if (Pawn != None)
{
/** Start the camera location from a valid socket name,
if set correctly in the camera properties */
// (i.e. WeaponSocket)
if (Pawn.Mesh!=None&&Pawn.Mesh.GetSocketByName
(CameraProperties.PawnSocketName)!=None)
{
Pawn.Mesh.GetSocketWorldLocationAndRotation
(CameraProperties.PawnSocketName, OutVT.POV.Location,
OutVT.POV.Rotation);
}
/** Otherwise grab it from the target eye view point */
else
{
OutVT.Target.GetActorEyesViewPoint
(OutVT.POV.Location, OutVT.POV.Rotation);
}
The weapon socket is one of the properties we'll declare in the
TutorialCameraProperties class, so we won't have to
worry about hardcoding it here just yet.
 
Search Nedrilad ::




Custom Search