Game Development Reference
In-Depth Information
I used a pitch of -80 degrees to have the camera point down at the pawn. You'll notice
that my pitch says -14000 here though. That's because of UDK's rotation system that
I mentioned earlier which is based on radians, remember? A pitch of -80 degrees is
roughly equivalent to 14000 of Unreal's unit of measurement.
/** Hardcoded vector & rotator values for our camera */
Next up, we need to make a change to our TutorialPawn class. There is only one
small change here from the changes we made during our side-scroller tutorial. We're
going to override the GetBaseAimRotation function found in the Pawn.uc class
again to have it suit our needs. 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, tempRot;
tempRot = Rotation;
POVRot = Rotation;
/** Stops the player from being able to adjust the pitch
of the shot, forcing the camera to always point down
towards the pawn
* We can still rotate left and right, however.*/
POVRot.Pitch = 0;
As you can see, we've set our POVRot to use the rotation of our pawn. Therefore, our
camera's rotation will follow the pawn's rotation. Additionally, we've set our Pitch to
0 , so that the player no longer has any control over the pitch of either the pawn, and
by extension, the camera.
Search Nedrilad ::

Custom Search