dao::CameraController

class

The controller of the camera in explore and combat mode: what the camera follows, where it looks, and the zoom the player has set.

Get it from GameModes::Camera.

Declared in dao/Camera.h.

Functions

CameraController()

CameraController()=delete

CameraController()

CameraController(const CameraController &)=delete

Focus()

Vector Focus() const

Returns the point the camera looked at in the last update: the followed object’s position plus the controller’s offset.

This is not where the camera is heading: while the game pans between creatures it is a point between them, and after SetFocusOffset it lags a frame behind.

FocusOffset()

Vector FocusOffset() const

Returns the focus’s offset from the followed object.

In the tactical view, this keeps the focus where it was when the target changed.

Follow()

void Follow(ObjectId object)

Makes the camera follow an object, as selecting a party member does, but without selecting it.

Any object works, including an enemy.

In the close view, the camera pans to the object if it is within 15 m of the previous one, and cuts to it otherwise. In the tactical view the camera stays where it is (see SetFocusOffset). Call on the game thread, for example from a frame callback.

operator=()

CameraController & operator=(const CameraController &)=delete

PullSpeed()

float PullSpeed() const

Returns the speed, in metres per second, at which the tactical view pulls the focus toward the nearest party member while neither that member nor the followed object is on screen.

The speed grows by 30 each second until one of them is; it is 0 when nothing is pulling.

Scene()

SceneCamera * Scene() const

Returns the scene camera that the controller drives.

SetFocusOffset()

void SetFocusOffset(Vector offset)

Sets the focus’s offset from the followed object; the focus moves on the next frame.

Easing the offset to zero pans to the target without turning the camera.

SetPullSpeed()

void SetPullSpeed(float metresPerSecond)

Sets the tactical view’s pull speed.

Setting it to 0 restarts the pull from rest.

Parameter  
metresPerSecond the speed, in metres per second

SetZoomSetting()

void SetZoomSetting(float zoom)

Sets the zoom as the mouse wheel does; the camera then eases toward it.

To ease the setting itself over time, use dao::camera::EaseZoom.

Parameter  
zoom from ZoomLeast to ZoomMost

SnapToTarget()

void SnapToTarget()

Moves the camera onto its focus immediately, as CenterOnObjectMessage does.

Tactical()

bool Tactical() const

Returns true in the tactical view, high above, and false in the close view.

Target()

ObjectId Target() const

Returns the id of the object the camera follows: the selected party member, unless a plugin has called Follow.

TurnBehind()

void TurnBehind(ObjectId object)

Turns the camera immediately to look along an object’s heading, putting it behind the object, the same way the game resets the camera.

Not yet tested in the game.

Zoom()

float Zoom() const

Returns the scene camera’s zoom mapped to -1 (the tactical view) to 1 (close in).

ZoomLeast()

float ZoomLeast() const

Returns the least zoom setting, the tactical view (-1).

ZoomMost()

float ZoomMost() const

Returns the greatest zoom setting, close in (1).

ZoomSetting()

float ZoomSetting() const

Returns the zoom the player has set with the mouse wheel, from ZoomLeast (-1, the tactical view) to ZoomMost (1, close in).

The scene camera eases toward it.

~CameraController()

~CameraController()=delete

Fields

Field Type  
kFocus std::size_t = 0x70 offset of the focus
kKeptOffset std::size_t = 0x100 offset of the focus’s kept offset
kOtherOffset std::size_t = 0xF0 offset of the focus’s second offset
kPullSpeed std::size_t = 0xEC offset of the pull speed
kSceneCamera std::size_t = 0x04 offset of the scene camera
kTarget std::size_t = 0x08 offset of the followed object’s id
kViewFlag std::size_t = 0x90 offset of the view flag, 1 when tactical
kZoomLeast std::size_t = 0x64 offset of the least zoom setting
kZoomMost std::size_t = 0x68 offset of the greatest zoom setting
kZoomSetting std::size_t = 0x48 offset of the zoom setting