This script contains often used functions for a controlling a camera in relation to a target entity (usually the player). The functions are also used by the car templates. The script contains a startup function (camera_startup) that toggles between the 6 available camera modes with the [C] key, activates the individual modes with the [F1] .. [F6] keys, and allows to zoom with the mouse wheel.
Var | Default | Remarks |
tcamera_mode | 1 |
Initial and current camera mode (1..6), used by camera_startup; 0 for disabling camera_startup. |
tcamera_dist | 250 |
Distance between camera and player in all modes except the first person camera. |
tcamera_height | 50 |
Vertical distance between camera and player for the chase, orbit, and fixed camera. |
tcamera_minDist | 100 |
Minimum distance between camera and player. |
tcamera_maxDist | 2000 |
Maximum distance between camera and player. |
tcamera_zoomDist | 2 |
Sensitivity of the mouse wheel for adjusting the camera distance between the minimum and maximum. |
tcamera_pos_x | 0 |
X position for the fixed camera mode. |
tcamera_pos_y | 0 |
Y position for the fixed camera mode. |
tcamera_offset_x | 0 |
X offset for the first person camera. |
tcamera_offset_y | 10 |
Y offset for the first and 3rd person camera. |
tcamera_offset_z | 20 |
Z offset for the first person camera. |
key_togglecamera | "c" |
Key to toggle the camera mode. |
joy_togglecamera | 4 |
Joystick button to toggle the camera mode. |
key_camera1 | "f1" |
Key to activate chase camera mode. |
key_camera2 | "f2" |
Key to activate orbit camera mode. |
key_camera3 | "f3" |
Key to activate fixed camera mode. |
key_camera4 | "f4" |
Key to activate offset camera mode. |
key_camera5 | "f5" |
Key to activate first person camera mode. |
key_camera6 | "f6" |
Key to activate third person camera mode. |
ent | Target entity, usually the player. |
height | Vertical offset of the camera to the target entity. |
angle | Difference of camera angle and target entity angle. |
dist | Distance of the camera and the target entity. |
offset | Offset vector, relative position of the camera to the target entity. |
factor | Influence of the entity's tilt and roll angle, 0 = no influence, 1 = full influence. |