new AxCamera(context)
Creates a new camera
Parameters:
Name | Type | Description |
---|---|---|
context |
Axis | The context to use for the camera |
- Source:
Methods
BuildMatrix(transform)
Builds the camera transformation matrix, based on a parent transform
Parameters:
Name | Type | Description |
---|---|---|
transform |
AxMatrix | The parent transform on which to build the camera's own transform. |
CastVector(screenCoords) → {AxVector3}
Returns a vector which projects from given coordinates on the camera screen into scene space.
The returned vector is normalized
Camera must have its matrices built in order for this method to work. This should normally not be an issue, since matrices of the camera are built by the BuildMatrix method, which is routinely called. If needed, call BuildMatrix() explicitly before calling this method.
Parameters:
Name | Type | Description |
---|---|---|
screenCoords |
AxVecto2 | The coordinates of the point on the screen, from which to project the ray. The coordinates must be in the range [-1, 1] from left to right and from bottom to top of the screen |
Returns:
A normalized vector, oriented along a point on the camera screen
- Type
- AxVector3
GetPixelSpaceCoords(worldPos) → {AxVector2}
Calculates the projected 2D coordinates on screen for a 3D point in space.
Coordinates are in screen space, in the interval [-1, 1]
Parameters:
Name | Type | Description |
---|---|---|
worldPos |
AxVector3 |
Returns:
- Type
- AxVector2
GetScreenSpaceCoords(worldPos) → {AxVector2}
Calculates the projected 2D coordinates on screen for a 3D point in space.
Coordinates are in pixel space
Parameters:
Name | Type | Description |
---|---|---|
worldPos |
AxVector3 |
Returns:
- Type
- AxVector2
ProjectVector(vector) → {AxVector3}
Returns a vector which is projected onto the camera screen from given point in scene space
Camera must have its matrices built in order for this method to work. This should normally not be an issue, since matrices of the camera are built by the BuildMatrix method, which is routinely called. If needed, call BuildMatrix() explicitly before calling this method.
Parameters:
Name | Type | Description |
---|---|---|
vector |
AxVector3 | The coordinates of a vector in scene space |
Returns:
The screen space coordinates of the vector, projected onto the camera screen. Coordinates are between the range [-1, 1] from left to right, bottom to top and back to forward
- Type
- AxVector3