Class: CameraHelper

CameraHelper(world)

Helper class containing camera creation and manipulation methods used elsewhere.

Constructor

new CameraHelper(world)

Parameters:
Name Type Description
world World
Source:

Classes

CameraHelper

Members

gamepadInput

Set if used, 3rd person camera only
Source:

lastInstance :CameraHelper

Last instance of CameraHelper created
Type:
Source:

mobileOrientationEnabled

Should mobile device orientation control camera orientation, defaults to static World.mobileOrientationEnabled
Source:

mobileOrientationEnabled

Should mobile device orientation control camera orientation, default false (cheap devices have bad sensors)
Source:

Methods

enableMobileOrientation(enabledopt)

Mobiles: use screen orientation to control camera rotation.
Parameters:
Name Type Attributes Default Description
enabled boolean <optional>
this.mobileOrientationEnabled true = use screen orientation, false = drag to rotate
Source:

firstPersonCamera(pos, name)

Utility method, calls this.universalCamera with given parameters, and sets the camera speed function. Original Babylon.js camera speed function takes FPS into account, but does not mean anything really. This one attempts to approximate meters per second, and is computationally cheaper. See https://forum.babylonjs.com/t/does-camera-speed-vary-depending-on-fps-performance/20802
Parameters:
Name Type Default Description
pos Vector3 to position camera at
name First Person Camera optional camera name, default First Person Camera
Source:

thirdPersonCamera(camera1p)

Utility method, creates 3rd person camera. Requires 1st person UniversalCamera already set, and sets rotation and direction based on it.
Parameters:
Name Type Description
camera1p 1st person UniversalCamera, defaults to this.world.camera
Source:
Returns:
created 3rd person ArcRotateCamera

universalCamera(pos, name)

Utility method, creates a UniversalCamera and sets defaults: gravity, collisions, ellipsoid, keys, mobile orientation.
Parameters:
Name Type Default Description
pos Vector3 to position camera at
name Universal Camera optional camera name, default Universal Camera
Source: