-
Notifications
You must be signed in to change notification settings - Fork 0
camera
content/camera.lua defines pplaf.camera - Camera framework.
pewpew camera follows average position of every player, controlled by player. pewpew functions also allow you to override camera position. PPLAF uses this feature to automate camera movement and allow you to control it by changing certain parameters.
To control camera parameters you use configure(). Let's see parameters, you can configure:
current_*- current x/y/z camera coordinate.static_*- if notnil, x/y/z camera coordinate won't be changed. If current coordinate isn't equal to static coordinate, camera will keep moving to static coordinate. Static value ignores any coordinate modifiers other thanfree_mode.offset_*- if notnil, additional offset will be added to camera x/y/z coordinate.min_*- if notnil, camera x/y/z coordinate won't get lower than this value.max_*- if notnil, camera x/y/z coordinate won't get higher than this value.base_z- basic z coordinate of camera. Originally it is same as inpewpew-1000fx.z_distance_ratio-camera.main()calculates biggest distance between 2 entities(that are used in average position calculation) and multiplies this value byz_distance_ratio. Then that value is added to z coordinate.movement_offset- maximum camera xy offset, applied while using movement joystick.movement_z_offset- maximum camera z offset, applied while using movement joystick.shooting_offset- maximum camera xy offset, applied while using shooting joystick.shooting_z_offset- maximum camera z offset, applied while using shooting joystick.following_type- index of following type. It determines which entities will be used to calculate average camera position. While usingconfigure(), you can input this parameter as name of the type and it will be transformed to index automatically.following_param- parameters, that will be used to calculate average camera position depending onfollowing_type.ease_function- custom ease function, that will be applied on certain distance to make camera movement look smooth. Ease function is required to take fx input and output fx value.ease_distance- if camera xy/z position is lower than this value, ease function will be applied.velocity- maximum speed of the camera.free_mode- iftrue, every parameter mentioned before(other thanvelocity) is ignored and camera is controlled by movement joystick.
following_type was mentioned before. There are multiple options for value of following_type and following_param. Type variants are stored in camera.following_types:
entity= 100 - single entity is followed,following_paramcontainsidof this entity.entity_list= 101 - multiple entities are followed,following_paramcontains ids of these entities.group= 200 - every entity in the group is followed,following_paramcontains name of the group.group_list= 201 - every entity in list of groups are followed,following_paramcontains names of the groups.all= 300 - every entity is followed,following_paramisn't used in this case.
following_types - table, containing possible options for following different groups of entities.
options - table, containing current parameters for camera position, speed, movement parameters, etc.
Configures options of camera.
pplaf.camera.configure({
static_x = 500fx,
static_y = 500fx,
})Camera callback that modifies camera position and other parameters depending on current parameters.
pplaf.camera.main()