Game Development Reference
In-Depth Information
2.
Follow that up by declaring the two new variables that we'll need, CamOffset ,
which is of type Vector , and CamOffsetRotation , which is of type Rotator .
Instead of relying on our archetype for values, we'll write them in
default properties and store them in these two variables.
/** Hardcoded vector offset we will use, rather than tweaking
values in the editor's CameraProperties */
varconst Vector CamOffset;
/** Hardcoded rotator offset we will use, rather than tweaking
values in the editor's CameraProperties */
varconst Rotator CamOffsetRotation;
3.
Our PostBeginPlay function is the same as before. However, now that we're
using a first person view, we'll want to hide the third person mesh, otherwise it
will constantly be clipping into the view of our camera. Therefore, we add this
bit of code to our UpdateViewTarget function:
Pawn = Pawn(OutVT.Target);
if (Pawn != None)
{
/** To hide the third person mesh */
Pawn.SetHidden(true);
/**********************************************************
* 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.
**********************************************************/
4.
This next part is new. We now want to declare where our point of view will begin by
using a socket. For the third person and over the shoulder views, the weapon works
well; but for first person, the pawn's head works best. The offset values, we declare
later, will all be from the socket point we declare here. If you aren't sure of which
socket to use, then the camera will start from our pawn's eyes by default.
/** socket not found, use the other way of updating vectors */
if(Pawn.Mesh.GetSocketWorldLocationAndRotation('HeadShotGoreSock
et', 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);
}
 
Search Nedrilad ::




Custom Search