Game Development Reference
In-Depth Information
local rotator POVRot;
// If we have no controller, 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;
}
This function sets our base aim rotator to use our point of view. It is called by our
GetAdjustedAimFor() function in our TutorialPlayerController class.
That function gives our controller an opportunity to adjust the aiming of the pawn.
Things such as aim error, auto aiming, and AI help for consoles are things we could
put here. The weapon class requests BaseAimRotation before firing in order to
compensate for any of these variables.
BaseAimRotation takes the rotation from a weapon before any
math or alterations are applied to it, such as auto aim, lock-on, or
any other adjustments or variables may be applied to it.
It sets BaseAimRot by checking that we have a pawn. If we do have one, it uses the
pawn's GetBaseAimRotation() function, otherwise it uses the weapon's rotation,
without applying any sort of modifier like auto aim, as seen by this line:
BaseAimRot = (Pawn != None) ? Pawn.GetBaseAimRotation()
: Rotation;
2.
Therefore, we need to set our GetBaseAimRotation function now.
/*****************************************************************
* Returns base Aim Rotation without any adjustment.
* We simply use our rotation. Only use this if you want
* your weapon trace to follow where your gun is pointed.
* Projectiles will now follow your trace. Comment out if
* you want to fire in middle of screen.
* @return POVRot
*****************************************************************/
simulated singular event Rotator GetBaseAimRotation()
{
local rotator POVRot;
 
Search Nedrilad ::




Custom Search