Camera handling
Player-controlled actors manage the viewport camera within the IActor::UpdateView(SViewParams &viewParams)
and IActor::PostUpdateView(SViewParams &viewParams)
functions.
The SViewParams
struct is used to define camera properties such as position, rotation, and field of view. By modifying the viewParams
reference inside the UpdateView
method, we can move our camera to the position we require for our game.
Note
CryMono actors receive and handle the UpdateView(ref ViewParams viewParams)
and PostUpdateView(ref ViewParams viewParams)
events in the same way C++ actors do.
Implementing IGameObjectView
In order to get view events, we'll need to implement and register a game object view. To do so, start by deriving from IGameObjectView
, and implement the following two pure virtuals it includes:
UpdateView
: This is called to update the view position, rotation, and field of viewPostUpdateView
: This is called after having updated the view
After implementing the game object view, we...