一.粒子实现方式
创建2D平面模型作为粒子基本单元,系统预制平面在particle_meshes.brf文件中,通过particle_blend着色器实现粒子透明度和着色效果.
#雨点粒子平面
prtcl_rain
#雪粒子平面
prtcl_snow
#烟尘粒子平面(马匹奔跑时产生)
prtcl_dust_a
prtcl_dust_b
#火焰粒子平面
prtcl_fire
二.粒子系统配置
创建通过module_particle_system.py配置粒子系统.可控制粒子的数量,强度,生命周期,使用粒子平面.
#粒子溅射类型
psf_always_emit = 0x0000000002
psf_global_emit_dir = 0x0000000010
psf_emit_at_water_level = 0x0000000020
psf_billboard_2d = 0x0000000100 # up_vec = dir, front rotated towards camera
psf_billboard_3d = 0x0000000200 # front_vec point to camera.
psf_billboard_drop = 0x0000000300
psf_turn_to_velocity = 0x0000000400
psf_randomize_rotation = 0x0000001000
psf_randomize_size = 0x0000002000
psf_2d_turbulance = 0x0000010000
psf_next_effect_is_lod = 0x0000020000#血迹粒子系统配置
("game_blood_2", psf_billboard_3d | psf_randomize_size|psf_randomize_rotation , "prt_mesh_blood_3",2000, 0.6, 3, 0.3, 0, 0, #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength(0.0, 0.25), (0.7, 0.1), #alpha keys(0.1, 0.7), (1, 0.7), #red keys(0.1, 0.7), (1, 0.7), #green keys(0.1, 0.7), (1, 0.7), #blue keys(0.0, 0.15), (1, 0.35), #scale keys(0.01, 0.2, 0.01), #emit box size(0.2, 0.3, 0), #emit velocity0.3, #emit dir randomness150, #rotation speed0, #rotation damping),
引擎定制粒子系统:
#水溅射粒子系统
psys_game_water_splash_3
psys_game_water_splash_2
psys_game_water_splash_1#马蹄烟雾
psys_game_hoof_dust_mud
psys_game_hoof_dust_snow
psys_game_hoof_dust#血迹粒子系统
psys_game_blood_2
psys_game_blood#天气粒子系统
psys_game_snow
psys_game_rain
三.使用粒子系统
#scene_prop初始化时使用
particle_system_add_new = 1965 # (particle_system_add_new, <par_sys_id>,[position]),# Adds a new particle system to an object. Uses position offset and color provided to previous calls to (set_position_delta) and (set_current_color). Can only be used in item/prop triggers.
particle_system_emit = 1968 # (particle_system_emit, <par_sys_id>, <value_num_particles>, <value_period>),# Adds a particle system in some fancy way. Uses position offset and color provided to previous calls to (set_position_delta) and (set_current_color). Can only be used in item/prop triggers.#在某个位置溅射粒子系统
particle_system_burst = 1969 # (particle_system_burst, <par_sys_id>, <position>, [percentage_burst_strength]),# Bursts a particle system in specified position.
particle_system_burst_no_sync = 1975 # (particle_system_burst_without_sync,<par_sys_id>,<position_no>,[percentage_burst_strength]),# Version 1.153+. Same as above, but apparently does not synchronize this between server and client.
prop_instance_add_particle_system = 1886 # (prop_instance_add_particle_system, <scene_prop_id>, <par_sys_id>, <position_no>),# Version 1.153+. Adds a new particle system to the scene prop. Note that <position_no> is local, i.e. in relation to scene prop's coordinates and rotation.
prop_instance_stop_all_particle_systems = 1887 # (prop_instance_stop_all_particle_systems, <scene_prop_id>),# Version 1.153+. Removes all particle systems currently associated with scene prop instance.