Latest version:
Tramway SDK 0.0.9
Github
Quick links
Home
Get Started

Camera


All camera types basically do a bit of logic and then come up with a position and a rotation. Then they pass them over to the Render system to and use them to set the View and pass them to the Audio system to set the listener.

Programming in C++


Camera Interface

#include <extensions/camera/camera.h>
API documentation page.

First Person Camera

#include <extensions/camera/firstperson.h>
API documentation page.

Here's how to do a first person camera.

// here will be our camera
Ext::Camera::FirstPersonCamera* camera = nullptr;

// this will be our player
Entity* player = Entity::Find("player");

// let's make a new camera
camera = new Ext::Camera::FirstPersonCamera;

// this attaches the camera to the player
camera->SetFollowing(player);

// this will allow rotation of the camera
// by moving the mouse cursor
camera->SetMouselook(true);

// this will rotate the player with the
// camera. useful if player has a visible
// 3D model
camera->SetRotateFollowing(true);

// this will position the camera half a meter
// above the player entity's middle point
camera->SetFollowingOffset({0.0f, 0.5f, 0.0f});

// this turns on the camera
camera->SetActive();

There are other camera types, but they are sort of unfinished.