Cameras capture and display the world, they are the eye for players, and can be set up in many ways. Cameras can be placed in the world to capture specific points of interest (that is security camera), capture, and render to UI, or simply be the eye for the player when looking down their gun.
When a new project is created, Core will automatically add a Third Person Camera to the Hierarchy under Game Settings. This will be the default camera which can be modified, or removed.
In the Core Content tab, under Game Components, drag the Camera component into the Scene or Hierarchy.
Press V to enable or disable the camera volume box in the Scene view.
By default, a camera will have the properties Set to Default, Attach to Local Player enabled, and Base Rotation Mode set to Look. If a camera needs to be fixed (that is a CCTV camera in a room), the following properties can be changed.
- Change Set to Default to be disabled.
- Change Attach to Local Player to be disabled.
- Change Based Rotation Mode to Camera.
Adding a new Camera to the Hierarchy may appear that nothing happens when entering Preview mode. This is because an existing camera is in the Hierarchy and has Set to Default, and Attach to Local Player enabled. To solo a camera in the Hierarchy, that camera will need to be Set to Default, and other cameras will need the following properties disabled.
- Set to Default
- Attach to Local Player
There are various properties that can be adjusted on the Camera that can change the way the player views the game.
Cameras can be positioned and rotated in the world by modifying the Position and Rotation properties.
For the rotation to take effect on a camera, the property Base Rotation Mode needs to be set to Camera under Rotation in the camera properties. Otherwise, the Rotation Offset can be used.
|Use as Default||This camera will be used initially as each player's default camera.|
|Field of View||Number of degrees across the player's view.|
|Attach to Local Player||Whether this camera starts attached to the local player.|
|Use Camera Socket||Whether to use the camera socket instead of the character's position. This adds a slight view bob and is often preferable for first-person cameras.|
|Position Offset||Offset in local space.|
|Position Offset Springs||Whether the position offset is part of the spring that gets compressed when the camera is pushed against a wall.|
|Initial Distance||Initial view distance of this camera.|
|Adjustable Distance||Whether players can manually adjust the distance.|
|Minimum Distance||Minimum distance if distance is adjustable.|
|Maximum Distance||Maximum distance if distance is adjustable.|
|Base Rotation Mode||Which base rotation should this camera use. Camera: the camera object itself. None: zero rotation. Look Angle: the follow player's look angle.|
|Rotation Offset||Rotation offset.|
|Free Control||Whether the player's rotation input (mouse or right stick by default) adds a rotation to this camera. This has no effect if rotation mode is Look Angle.|
|Initial Pitch||Initial pitch of the free control rotation. Requires Free Control.|
|Minimum Pitch||Minimum pitch. Requires Free Control.|
|Maximum Pitch||Maximum Pitch. Requires Free Control.|
|Initial Yaw||Initial yaw of the free control rotation. Requires Free Control.|
|Limited Yaw||Whether the free control's yaw component is limited. Request Free Control.|
|Minimum Yaw||Minimum yaw. Requires Limited Yaw.|
|Minimum Yaw||Maximum yaw. Requires Limited Yaw.|
|Use As Audio Listener||Whether this camera will be used as the listener location for audio while active (the default behavior is to use the player).|
|Audio Listener Offset||An offset for where the listener will be relative to the camera, if the camera is a listener (see Use As Audio Listener).|
|Editor Indicator Visibility||Controls when the object's volume indicator is shown in the editor.|
|Is Advanced||Any descendents that are marked as Is Advanced will be hidden from the hierarchy.|
A Camera can be used to override other cameras in the Hierarchy. This can useful for a few reasons, for example, a cinematic shot of the player entering a new area. Or a CCTV camera the player can use to view another area of the map that is under surveillance.
In a Lua script, the
SetOverrideCamera function can be used by passing in the Camera as an argument that will be used to override other cameras in the Hierarchy. Clearing an override camera can be done by using the
local CAMERA = script:GetCustomProperty("Camera"):WaitForObject() local localPlayer = Game.GetLocalPlayer() localPlayer:SetOverrideCamera(CAMERA)
A Camera has the ability capture the view from the camera to an image at different resolutions. These captured images then be used else where, for example, capturing an object in the world and using it as item in a UI inventory system.
To capture images from a camera, the
Capture function can be used in a Lua script.
Core comes with some templates for a few different camera setups for different game genres. These can be found in Camera, under Game Components, in Core Content.
The first person camera shows what a player is looking at from the viewpoint of the player's character. This type of camera can be used in first person shooter (FPS) games.
The third person camera view will show the player's character to the player. Sometimes the camera is offset from the character to give it a feeling of appearing over the shoulder. This type of camera can be used in third person shooters (TPS) and adventure games.
The top down camera view will show an overhead view of the game play. This type of camera can be used in real time strategy (RTS), and simulation games.
The isometric camera view is pointed at a fixed angle (that is 45 degrees) towards the player's character. This type of camera can be used in real time strategy, and role playing games.
A side scroller camera is a view point from a side view angle, and usually the player's character moves left and right, and the screen scrolls with the character. This type of camera can be used for 2D games.
The player settings object has properties that handle player movement control, and camera control.
This setting controls where the aim is calculated from. For example, in a third person camera, the aim is usually calculated from the camera view (view relative), but in a side scroller view, the aim would be calculated based on the eye position (look relative) of the player's character.
|View Relative||Ability aim is calculated from the camera origin along the camera forward direction.|
|Look Relative||Ability aim is calculated from the players eye position along the player look direction.|
See the video below to see the difference when using a side scroller camera. The Ability Aim Mode is set to Look Relative, then changed to View Relative. Watch the bullet trail to see the difference between the 2 settings.
The Control category in the Properties window has properties to control how the player's character moves and rotates.
|Can Move Forward||If true, the player will be able to move in the forward direction. If false, the player won't be able to more in the forward direction.|
|Can Move Backward||If true, the player will be able to move in the backward direction. If false, the player won't be able to more in the backward direction.|
|Can Move Left||If true, the player will be able to move in the left direction. If false, the player won't be able to more in the left direction.|
|Can Move Right||If true, the player will be able to move in the right direction. If false, the player won't be able to more in the right direction.|
|Can Move up (Swimming / Flying)||If true, the player will be able to move up while swimming or in flying mode.|
|Can Move Down (Swimming / Flying)||If true, the player will be able to move down while swimming or in flying mode.|
Can be used to specify how players control their movement.
|None||Movement input is ignored.|
|Look Relative||Forward movement follows the current player's look direction.|
|View Relative||Forward movement follows the current view's look direction.|
|Facing Relative||Forward movement follows the current player's facing direction.|
|Fixed Axes||Movement axes are fixed.|
With Fixed Axes, the forward and back are fixed on the Y direction, and the left and right are fixed on the X direction
Can be used to specify how players control their look direction.
|None||Look input is ignored.|
|Relative||Look input controls the current look direction.|
|Look at Cursor||Look input is ignored. The player's look direction is determined by drawing a line from the player to the cursor on the Cursor Player.|
If the option Look at Cursor is selected, then 3 properties will appear after the Look Control Mode property.
In Look Control Mode: Look at Cursor, a cursor position is mapped into the world using this plane.
|Player Position||The cursor plane is centered on the Player.|
|World Origin||The cursor plane is centered at the world origin (0, 0, 0).|
Distance the cursor plane is offset along the plane's normal.
Can be used to specify what controls a player's facing direction.
|Face Aim When Action||The player faces their look direction while moving.|
|Face Aim Always||The player will always face their look direction.|
|Face Movement||The player face the direction of their movement.|
In this video, the difference can be seen when moving the player's character around.