Search public documentation:
Last tested against UDK May, 2012
- MOBA Starter Kit - Mobile Camera System
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.
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.
- 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.
- HoverDistance - How high off the hero the camera should be.
- SetDesiredCameraLocation() - This sets the desired camera location.
- DesiredCameraLocation - Current desired camera location.
- IsTrackingHeroPawn - If true, then the camera should be tracking the hero.
- 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.
- 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.
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.