Camera
The Camera position and orientation can be set through ThreeDFrame:setCamera and read from
ThreeDFrame.camera.
We can set all values at once:
ThreeDFrame:setCamera(x, y, z, rotationX, rotationY, rotationZ)
Or update only the position of the camera by not specifying the orientation:
ThreeDFrame:setCamera(x, y, z)
Or we can read from
ThreeDFrame.camera and update only one value to rotate the camera horizontally:
ThreeDFrame:setCamera(nil, nil, nil, nil, ThreeDFrame.camera[5] + 90, nil)
Alternatively we can keep track of our own camera and set the
ThreeDFrame camera to those values:
local camera = {
x = 1, -- x
y = 10, -- y
z = 1, -- z
rotX = 0, -- rotation around x axis
rotY = 0, -- rotation around y axis
rotZ = 0, -- rotation around z axis
}
-- set values one by one
ThreeDFrame:setCamera(camera.x, camera.y, camera.z,
camera.rotX, camera.rotY, camera.rotZ)
-- pass the camera
ThreeDFrame:setCamera(camera)
Finally, we can change the field of view using ThreeDFrame:setFoV.
ThreeDFrame:setFoV(60) -- 60 degrees