static class
Camera (client-side)
Available since version: 0.1.3
This class represents in game Camera.
Properties
Mat4&
vobMatrix
Available since version: 0.2.0
Represents the reference to the camera vob matrix in world space.
Mat4&
viewMatrix
Available since version: 0.2.0
Represents the reference to the camera view matrix.
Mat4&
projectionMatrix
Available since version: 0.2.0
Represents the reference to the camera projection matrix.
Mat4&
worldMatrix
Available since version: 0.2.0
Represents the reference to the camera world matrix.
Mat4&
worldViewMatrix
Available since version: 0.2.0
Represents the reference to the camera world-view matrix.
bool
modeChangeEnabled
Available since version: 0.1.3
Represents the camera mode change feature.
When mode change is enabled, game switches between different camera modes, e.g: when you draw weapon, camera mode will switch to "CAMMODMELEE"
.
bool
movementEnabled
Available since version: 0.1.3
Represents the camera movement feature.
When movement is disabled, the camera gets detached from the player.
Methods
setMode
Available since version: 0.1.3
This method will set the camera mode.
void setMode(string mode, array[userpointer] targetList)
Parameters:
string
mode: the camera mode.array[userpointer]
targetList: =[] the list containing vobs used by the specific camera mode, e.g: CamModDialog requires list containing two npc pointers.
getMode
Available since version: 0.1.3
This method will get the camera mode.
string getMode()
Returns string
:
the camera mode.
getPosition
Available since version: 0.1.3
This method will get the camera position.
{x, y, z} getPosition()
Returns {x, y, z}
:
the camera position.
setPosition
Available since version: 0.1.3
This method will set the camera position.
void setPosition(float x, float y, float z)
Parameters:
float
x: the position on x axis.float
y: the position on y axis.float
z: the position on z axis.
getRotation
Available since version: 0.1.3
This method will get the camera rotation.
{x, y, z} getRotation()
Returns {x, y, z}
:
the camera rotation.
setRotation
Available since version: 0.1.3
This method will set the camera rotation.
void setRotation(float x, float y, float z)
Parameters:
float
x: the rotation on x axis in deegres.float
y: the rotation on y axis in deegres.float
z: the rotation on z axis in deegres.
project
Available since version: 0.1.10
This method will convert point from 3d world space to screen coordinates (pixels).
{x, y} project(float x, float y, float z)
Parameters:
float
x: the position on x axis.float
y: the position on y axis.float
z: the position on z axis.
Returns {x, y}
:
screen coordinates represented as pixels. If projected point is behind camera, null
is returned instead.
backProject
Available since version: 0.2.1
This method will convert point from 2d screen coordinates (pixels) to 3d world space.
{x, y, z} backProject(int screenX, int screenY, float distance)
Parameters:
int
screenX: the x position on screen in pixels.int
screenY: the y position on screen in pixels.float
distance: the relative distance from the camera.
Returns {x, y, z}
:
world space coordinates.
enableMovement
Deprecated since version: 0.1.10
This method will enable the movement for the camera.
When movement is disabled, the camera gets detached from the player.
void enableMovement(bool toggle)
Parameters:
bool
toggle:false
if you want to detach camera from player, otheriwsetrue
.
setTargetVob
Available since version: 0.1.3
This method will set the target vob for the camera.
void setTargetVob(Vob vob)
Parameters:
Vob
vob: the vob object reference.
setTargetPlayer
Available since version: 0.1.3
This method will set the target player for the camera.
void setTargetPlayer(int playerId)
Parameters:
int
playerId: the id of the player.