Home > UDK > UDK Isometric Camera tutorial

UDK Isometric Camera tutorial

November 23, 2009

This tutorial is following the recent posting here that contains basic links to learn how to set up visual studio with nfringe to get started on coding unreal scripts (EDIT : You can now have a real help in setting up everything right here). Now you could use Kismet to produce the same result as the following unrealscript but the Kismet script will have to be contained within a level. This does not make practical the fact that most of the time the camera will most certainly be the same in an RTS or RPG isometric game.

What will be covered in this tutorial

  • Basic Game main class
  • Basic Game Controller
  • Basic Camera for defaulting to 3rd person
  • Basic Pawn definition for the main player

What will not be covered in this tutorial

  • Click on the map
  • Any mouse interactions
  • Pawn rotation and basic A.I.


The first Thing we will cover, will be the main game class. If you are starting out fresh and do not want support for Unreal Deathmatch, you will want to use GameInfo as a base class for your game.

class MyGameInfo extends GameInfo;



Now the declared default properties help initialize basic variables akin to what you would do in any Property Editor except they are hardcoded in text. Both declared classes are to inform the UDK framework with which classes this game should work for the player controller (where the player code and interactions are located) and the pawn class that represent physically the player in the world. I Suggest you do look at the classes this tutorial expands on, as it will give you unvaluable insight on what is used when. So that is it for the base game class. Remember that you should declare it correctly inside UTEngine.ini and UTGame.ini (see the tutorial referenced above if you are not knowledgable about that.)

class MyPlayerController extends PlayerController

function UpdateRotation( float DeltaTime )
	local Rotator	ViewRotation;

	ViewRotation.Pitch = (-45.0f * DegToRad) * RadToUnrRot;
	ViewRotation.Yaw = (-45.0f * DegToRad) * RadToUnrRot;



Now this one is pretty interesting. Its the basic player controller. Normally, you would put all code that pertains to game movement, menu handling and such in this controller. It will have a very close relationship with the custom game pawn bellow. We have overriden the UpdateRotation function because it is exactly here that we will force the 3rd person camera to be in a specific angle. Now Unreal has a very perticular way of treating rotations. They amount to a an integer (-65537 to 65537) where 65537 is equal to 360 degree. You could simply put your angle in there to save the calculus in each frame, but it is nice to know how to specify it in human readable format. You can look the DegToRad constant and RadToUnrRot in Object.uc. It should look as follow :

const MaxInt		= 0x7fffffff;
const Pi			= 3.1415926535897932;
const RadToDeg		= 57.295779513082321600;	// 180 / Pi
const DegToRad		= 0.017453292519943296;		// Pi / 180
const UnrRotToRad	= 0.00009587379924285;		// Pi / 32768
const RadToUnrRot	= 10430.3783504704527;		// 32768 / Pi

On to the camera and default properties of 3rd person. Now UDK has a very good third person camera. It would be a shame not to use it to its full potential. you will see with some default properties, you can smooth out cam movement without a single line of code added.

class MyPlayerCamera extends GamePlayerCamera;

protected function GameCameraBase FindBestCameraType(Actor CameraTarget)
	return ThirdPersonCam;


The FindBestCameraType will always force a return of the 3rd person camera.

class MyThirdPersonCamera extends GameThirdPersonCamera;


The MyThirdPersonCamera simply exist to specify our implementation of _Default values declared as follow:

class MyThirdPersonCameraMode_Default extends GameThirdPersonCameraMode_Default;

var float FOV;

function float GetDesiredFOV( Pawn ViewedPawn )
	return FOV;


The DefaltProperties are what will make the camera interpolate on the movement of the Pawn. The offset will permit you to specify a default height. Like I said at the beginning, this is to start you up, you should look in the forum to implement the mouse cursor and such. I will probably do a part 2 of this tutorial when I find out more about it.

Hope it helps people out !

you can follow it up here on the forum

Update me when site is updated
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • PDF
  • Twitter
Categories: UDK
  1. vitiank
    March 19th, 2010 at 11:31 | #1

    hey there. i got some troubles folowing ur tutorial. got warning while scripts r rebuilt after changes i made. and it looks like that http://img169.imageshack.us/img169/772/84248706.jpg

    how can i solve the problem?

  2. Hotdot
    March 20th, 2010 at 19:28 | #2

    The image is not accessible for some unknown reason, but if you ever got stuck at some point i suggest you download the source file from here : http://x9productions.com/blog/?page_id=451 and download a source file compare software.

Comments are closed.