Game Development Reference
In-Depth Information
Furthermore, it allows the camera to clip beneath the ground and turn it invisible.
If we continue to use the WeaponSocket socket, the camera pulls itself in, towards
the pawn, as we get closer to the ground. Use the one that best suits your needs.
Finally, we change our hardcoded default properties:
/** Hardcoded vector & rotator values for our camera */
Again, this is purely a matter of preference. Adjust it accordingly.
10. There is one final change to make, and that's in our TutorialPawn class. We
need to change our GetBaseAimRotation method. This function is called by
GetAdjustedAimFor in the player controller, which is the rotator for where the
pawn will be aiming its shots. Essentially, we are telling the game to use the direction
the pawn is facing for firing shots, and not the camera's. Add the following code:
* Forces the weapon to use the pawn's direction for aiming,
and not the camera's.
* shots will be fired in the direction the gun is pointed.
Used by PlayerController
* Comment this out if you are not using the Side Scrolling
* @return POVRot.
simulated singular event Rotator GetBaseAimRotation()
local rotator POVRot;
/** We simply use our rotation */
POVRot = Rotation;
/** If our Pitch is 0, then use RemoveViewPitch */
if( POVRot.Pitch == 0 )
POVRot.Pitch = RemoteViewPitch << 8;
return POVRot;
11. Compile the project and take a look at your results!
Search Nedrilad ::

Custom Search