There was a small error in the example file that was posted on the website and in the download.
I uploaded a new zip file, but the API itself hasn't changed any.
This is a simple snippet to make a fixed third person camera in the newly released Unreal Development Kit (UDK). Found in this thread.
class RPGController extends UTPlayerController;
//Camera Calculations
var vector LastViewLoc;
var vector CameraOffset;
var vector CameraOffset2;
//Force third-person
function SetBehindView( bool bNewBehindView )
{
super.SetBehindView( true );
}
// RPG Camera (based on Third-Person Camera)
simulated event GetPlayerViewPoint( out vector POVLocation, out Rotator POVRotation )
{
if ( ViewTarget != none )
{
LastViewLoc = ViewTarget.Location;
bCollideWorld = true;
}
POVLocation = LastViewLoc + CameraOffset2;
POVRotation = rotator( -CameraOffset );
StopViewShaking();
if ( CameraEffect != none )
CameraEffect.UpdateLocation( POVLocation, POVRotation, GetFOVAngle( ) );
}
// Allows the mouse to still aim weapons
function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}
defaultproperties
{
//Camera
bBehindView=true;
CameraOffset=(X=1,Y=1,Z=1)
CameraOffset2=(X=200,Y=200,Z=300)
}