Lua Class - camera

camera is a class that contains 3 properties, 2 methods and 0 events.

This class cannot be constructed, it is managed by Teverse.

In teverse, the user views the 3D scene through a camera. You can control the camera's position, orientation and field of view to alter what part of the scene the user can see.

With our Lua api, you can access the camera singleton through teverse.scene.camera. Note that your tevapp manifest should have permissions to access the scene singleton.

Properties
number fov

field of view

CODE SAMPLE
camera.fov = 1.0
print(camera.fov) --> 1.0
vector3 position

CODE SAMPLE
camera.position = vector3(10, 10, 10)
print(camera.position) --> vector3(10, 10, 10)
quaternion rotation

CODE SAMPLE
camera.rotation = quaternion
print(camera.rotation) --> quaternion
Methods
vector3, number screenToWorld( vector2 screenPos )

Returns a 3d vector

CODE SAMPLE
camera:screenToWorld(vector2(10, 10)) --> vector3(10, 10, 10),  number
vector2, number worldToScreen( vector3 wPos )

Returns a 2d screen space vector and a number representing depth

CODE SAMPLE
camera:worldToScreen(vector3(10, 10, 10)) --> vector2(10, 10),  number
Events

Some sections of our docs are maintained on github.