BBMOD_Camera

Extends BBMOD_BaseCamera

constructor

new BBMOD_Camera()

Description

A camera driven by angles and an object to follor, rather than raw vectors. Supports both first-person and third-person view and comes with a mouselook implementation that also works in HTML5.

Properties

Name Description
Direction The camera's horizontal direction. Defaults to 0.
DirectionUp The camera's vertical direction. Automatically clamped between BBMOD_Camera.DirectionUpMin and BBMOD_Camera.DirectionUpMax. Defaults to 0.
DirectionUpMax Maximum angle that BBMOD_Camrea.DirectionUp can be. Use undefined to remove the limit. Default value is 89.
DirectionUpMin Minimum angle that BBMOD_Camrea.DirectionUp can be. Use undefined to remove the limit. Default value is -89.
FollowCurve A function which remaps value in range 0..1 to a different 0..1 value. This is used to control the follow curve. If undefined then lerp is used. Defaults to undefined.
FollowFactor Controls lerp factor between the previous camera position and the object it follows. Defaults to 1, which means the camera is immediately moved to its target position. BBMOD_Camera.FollowObject must not be undefined for this to have any effect.
FollowObject An id of an instance to follow or undefined. The object must have a z variable (position on the z axis) defined! Defaults to undefined.
MouseLook If true then mouselook is enabled. Defaults to false.
MouseSensitivity Controls the mouselook sensitivity. Defaults to 1.
Offset The camera's offset from its target. Defaults to (0, 0, 0).
Roll The angle of camera's rotation from side to side. Default value is 0.
Zoom The camera's distance from its target. Use 0 for a first-person camera. Defaults to 0.

Methods

Name Description
set_mouselook Enable/disable mouselook. This locks the mouse cursor at its current position when enabled.
update Handles mouselook, updates camera's position, matrices etc.

Example

// Create event
camera = new BBMOD_Camera();
camera.FollowObject = OPlayer;
camera.Zoom = 0.0; // Use 0.0 for FPS, > 0.0 for TPS

// End-Step event
camera.set_mouselook(true);
camera.update(delta_time);

// Draw event
camera.apply();
// Render scene here...
Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on November 16, 2022 using GMDoc.