Constructor
new(fovY:Float = 25., zoom:Float = 1., screenRatio:Float = 1.333333, zNear:Float = 0.02, zFar:Float = 4000., rightHanded:Bool = false)
Variables
fovY:Float
The vertical FieldOfView, in degrees. Usually cameras are using an horizontal FOV, but the value will change depending on the screen ratio. For instance a 4:3 screen will have a lower horizontal FOV than a 16:9 one, however the vertical FOV remains constant. Use setFovX to initialize fovY based on an horizontal FOV and an initial screen ratio.
Methods
inlinegetForward():Vector
Returns the forward of the camera. Cache the result until the next update().
getInverseProj():Matrix
Returns the inverse of the camera matrix projection. Cache the result until the next update().
getInverseView():Matrix
Returns the inverse of the camera matrix view only. Cache the result until the next update().
getInverseViewProj():Matrix
Returns the inverse of the camera matrix view and projection. Cache the result until the next update().
project(x:Float, y:Float, z:Float, screenWidth:Float, screenHeight:Float, snapToPixel:Bool = true, ?p:Vector):Null<Vector>
inlineprojectInline(x:Float, y:Float, z:Float, screenWidth:Float, screenHeight:Float, snapToPixel:Bool = true):Vector
Project a 3D point into the 2D screen. Make sure to update() the camera if it's been moved before using that.
setFovX(fovX:Float, withRatio:Float):Void
Set the vertical fov based on a given horizontal fov (in degrees) for a specified screen ratio.
unproject(screenX:Float, screenY:Float, camZ:Float):Vector
Transforms a 2D screen position into the 3D one according to the current camera. The screenX and screenY values must be in the [-1,1] range. The camZ value represents the normalized z in the frustum in the [0,1] range. [unproject] can be used to get the ray from the camera position to a given screen position by using two different camZ values. For instance the 3D ray between unproject(0,0,0) and unproject(0,0,1) is the center axis of the 3D frustum.