UDN
Search public documentation:

MOBAKitMobileCamera
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Unreal Development Kit Gems > MOBA Starter Kit > Mobile Camera System

MOBA Starter Kit - Mobile Camera System


Last tested against UDK May, 2012

Overview


The mobile camera systems uses a fixed camera which follows the player's hero most of the time. The player is able to pan the camera independently when using the mini map controls. The relevant classes are:

  • UDKMOBACamera - This is the base camera class which provides a common interface for the game to use.
  • UDKMOBACameraProperties - This is an archetype class object which is used for data storage.
  • UDKMOBACamera_Mobile - This is the mobile variation of the camera.
  • UDKMOBACameraProperties_Mobile - This is the mobile variation of the camera properties.

Why use UDKMOBACameraProperties and UDKMOBACameraProperties_Mobile?


Using archetypes to store data which is used by UDKMOBACamera and UDKMOBACamera_Mobile makes it much easier to iterate changes within Unreal Editor as it provides real time feedback as to what those property changes will look like in game.

UDKMOBACameraProperties Variables

  • Rotation - Constant camera rotation. This property sets the fix camera rotation and is usually pointed down wards in this case.
  • BlendSpeed - Speed at which the camera blends from one place to another. The higher number is, the faster that the camera will blend from one place to another.

UDKMOBACameraProperties_Mobile Variables

  • HoverDistance - How high off the hero the camera should be.

UDKMOBACamera


Functions

  • SetDesiredCameraLocation() - This sets the desired camera location.

Variables

  • DesiredCameraLocation - Current desired camera location.
  • IsTrackingHeroPawn - If true, then the camera should be tracking the hero.

UDKMOBACamera_Mobile


Functions

  • SetDesiredCameraLocation() - This sets the secondary desired camera location.
  • UpdateViewTarget() - This is the main function which is used by the camera to calculate where it should be.

Variables

  • CameraProperties - Reference to the UDKMOBACameraProperties_Mobile archetype.
  • SecondaryDesiredCameraLocation - Secondary desired camera location, this is needed as the player is able to also control the camera using the mini map.

UDKMOBACamera_Mobile::UpdateViewTarget()


This function is responsible for where the camera is placed in the mobile version.

First, the function performs an early out by checking if the CameraProperties variable is none. If it is, then it just returns the default implementation.

Next, it checks if the player is touching the mini map or not. If the player is touching the mini map and the mode is set to camera, then the target location is set as the SecondaryDesiredCameraLocation. Otherwise the target location is set to the player's hero.

The DesiredCameraLocation is then set based on the value of TargetLocation. This is the reason why SecondaryDesiredCameraLocation was needed, because otherwise the DesiredCameraLocation would have been clobbered by the mini map camera commands.

When DesiredCameraLocation has been set, the camera's location (OutVT.POV.Location) is then interpolated to it over time.

Finally, the camera's rotation (OutVT.POV.Rotation) is set to the Rotation stored in CameraProperties.