modules.camera#

class modules.camera.Camera(context)#

Bases: object

class VelocityModifier_(*values)#

Bases: IntEnum

normal = 1#
slow_down = 3#
speed_up = 2#
__init__(context)#

This class is responsible for creating the viewmatrix, Based on what camera is active, either from scene or editor

Parameters:

context (EmberEngine) – This is the main context of the application

property camera: GameObject_Camera#
get_view_matrix()#

Get the current view matrix, based on if game is running, switch between editor and scene camera

Returns:

The viewmatrix from the current active camera

Return type:

matrix44 or Matrix44

get_view_matrix_running() Matrix44#

Get the view matrix from the camera gameObject when the game is running. Do this by placing an object in front of the cameras direction, and use lookAt.

Returns:

The viewmatrix from the active Camera gameobject, return Identity when no camera

Return type:

matrix44 or Matrix44

new_frame()#

Called on beginning of a frame, trigger keyboard and mouse processing when in editor mode

place_object_in_front_of_another(position, rotation_quat, distance) Vector3#

-This should become a scriptable function perhaps

Parameters:
  • position (Vector3) – The position of the parent object

  • rotation (Vector3) – The rotation of the parent object

  • distance (float) – The distance the object is placed from the parent on the Z-axis

Returns:

The position of an object placed in front of another object along the Z-axis at a defined distance

Return type:

Vector3

process_keyboard()#

Handle key events for the editor camera

process_mouse_movement(constrain_pitch: float = 89.5)#

Handle mouse events for the editor camera, with constraints and sensitivity bias.

Parameters:

constrain_pitch (bool) – Enable to contraint the pitch to 45degrees both directions

update_camera_vectors()#

Convert radians to camera axis for editor camera

update_yaw_pitch_from_front()#

Update jaw (yaw) and pitch based on current camera_front