Difference between revisions of "Editor Camera Script External Code"

From Wolfire Games Wiki
Jump to: navigation, search
m (CameraObject class)
m (CameraObject class)
Line 34: Line 34:
  
 
'''Related Global Variables'''
 
'''Related Global Variables'''
<pre style="white-space: pre-wrap;">CameraObject co;  // The global instance of this class</pre>
+
<pre style="white-space: pre-wrap;">CameraObject co;  // The global instance of this camera controller class</pre>
 
<pre style="white-space: pre-wrap;">Camera camera;  // The global instance of an object for controlling the actual camera itself</pre>
 
<pre style="white-space: pre-wrap;">Camera camera;  // The global instance of an object for controlling the actual camera itself</pre>

Revision as of 03:10, 19 November 2017

This is a list of the external code that is only available to be used inside the editor camera script - variables, functions, and classes that "magically" exist.

To see a list of external code that is available to all scripts, please see this page - Common Script External Code

This page is manually updated, so may be slightly out of date from time to time. TODO: Add camera script page and link its docs section here, similar to the LevelScripts#Documentation page section.

Global Variables

CameraObject co;  // Access the camera controller itself, including parameters that aren't accessible from other scripts

Classes

CameraObject class

class CameraObject;

Access the camera controller object.

This lets you access parameters that aren't accessible from other scripts, such as whether the camera is controlled by a player, frozen, or ignoring mouse input.

It also gives access to a quaternion representing the orientation of the camera, instead of Camera's euler angle access functions.

Properties

vec3 velocity;  // The current velocity of the camera controller
bool controlled;  // Whether the camera controller is currently being controlled by a player
bool frozen;  // If the script should ignore all controller input. The engine doesn't currently use this at all
bool ignore_mouse_input;  // If the script should ignore mouse input. Engine sets this when editor is doing selection, transformations
bool has_position_initialized;  // Initialized to false when a level loads. Useful for teleporting the camera to the first controlled movement object

Methods

const quaternion& GetRotation();  // Get the current direction of the camera controller
void SetRotation(const quaternion &in quat);  // Set the current direction of the camera controller
const vec3& GetTranslation();  // Gets the current position of the camera controller
void SetTranslation(const vec3 &in vec);  // Sets the current position of the camera controller. TODO: Should you also always set camera.SetPos to the same value?

Related Global Variables

CameraObject co;  // The global instance of this camera controller class
Camera camera;  // The global instance of an object for controlling the actual camera itself