Jump to content
Sign in to follow this  
_William

Foliage Camouflage System

Recommended Posts

The Foliage Camouflage System (FolCamS) is a 'logic' module that attaches foliage to tanks, cars and artillery to camouflage them. This add-on recreates in Arma 2 the practice of camouflaging vehicles with twigs and leaves, as practiced by WWII Wehrmacht and Cold War NATO forces. Foliage camouflage works in SP and MP.

FolCamS comes with a database of vehicle dimensions, which enables it to camouflage over 180 vehicles from popular WWII and NATO forces out of the box. And for vehicle classes not yet supported, mission creators can simply add or change vehicle data at mission start, so their mission's vehicles will be camouflaged as well. See the 13 page manual (included) for detailed instructions.

FolCamS can attach foliage to the hull and to the turret (memory points). It spawns a per-vehicle script to align the turret-attached foliage with the rotating turret.

For now, only conifer camouflage is being available, but FolCamS is capable using other vegetation when made available.

_foliage_concealed_bradley_engaging.jpg _foliage_camouflaged_pak40.jpg _foliage_camouflaged_fv432_and_infantry.jpg _a2_foliage_covered_marders_in_a_german_village.jpg

I've uploaded a movie so you can see the camouflage in motion (in P85 / CWR2:BAF / I44 and BAOR vehicles). The code to update the vehicle database has been changed slightly, so be sure to check the manual included in the add-on for details.

5XHeGIJqNQI

Downloads:

- 1.0.0 at dev.withsix.com/projects/folcams (1.6MB)

Example vehicle dimensions (from the FolCamS vehicle database):

// Tanks
["M1A1",         [["length",  7.5], ["width", 3.4], ["forward_offset", 3.0], ["hull_height", 1.4], ["hull_length", 4.0], ["bumper_height", 0.8], ["roof_height", 1.8], ["roof_length", 3], ["turret_names", ["kulas", "OsaVelitele", "mainTurret"]], ["turret_rotation", 270] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['M1A2_TUSK_MG', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["BWMod_Leopard_2A6",        [["length",  6.5], ["width", 3.2], ["forward_offset", 1.8], ["hull_height", 1.7], ["bumper_height", 0.9], ["turret_names", ["machine gun"]], ["turret_rotation", 270] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BWMod_Leopard_2A6_Desert', 'BWMod_Leopard_2A6', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["p85_LEO1A2", 				 [["length",  6.5], ["width", 3.1], ["forward_offset", 2.1], ["hull_height", 1.8], ["bumper_height", 0.9], ["turret_names", ["kulas", "OtocVez", "OtocVez_2"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_LEO1A4',  'p85_LEO1A2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_LEO1A4c', 'p85_LEO1A4', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_LEO1A5',  'p85_LEO1A4', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_LEO1A5c', 'p85_LEO1A5', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
["p85_LEO2A4g", 			 [["length",  6.5], ["width", 3.2], ["forward_offset", 2.9], ["hull_height", 1.8], ["bumper_height", 0.9], ["turret_names", ["kulas", "OtocVez", "OtocVez_2"]], ["turret_rotation", 180]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_LEO2A4c', 'p85_LEO2A4g', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_JPZ1', 		         [["length",  6.0], ["width", 3.1], ["side_offset", -0.3], ["forward_offset", 3.0], ["hull_height", 1.9], ["bumper_height", 1.0], ["turret_names", ["OtocVez"]]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_JPZ2', 'p85_JPZ1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
["p85_m60tank", 			 [["length",  7.5], ["width", 3.3], ["forward_offset", 2.0], ["hull_height", 1.8], ["bumper_height", 0.9], ["turret_names", ["kulas", "kanon", "OtocVez"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_m60tankg', 'p85_m60tank', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_m60tank_merdc', 'p85_m60tank', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_M1Abrams', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_M1A1Abrams', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_M1Abrams_merdc', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_M1A1AbramsHA', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['cwr2_M1A1', 'M1A1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['cwr2_M60A3', 'p85_m60tank', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["cwr2_Challenger",		 [["length",  7.1], ["width", 3.2], ["forward_offset", 1.9], ["hull_height", 1.5], ["bumper_height", 0.8], ["roof_height", 1.8], ["roof_length", 4], ["turret_names", ["kulas", "kanon", "OtocVez"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;


["ChieftainMK9", [["length",  6.1], ["width", 3.2], ["side_offset", 0.3], ["forward_offset", 2.9], ["hull_height", 1.5], ["bumper_height", 0.8], ["roof_height", 1.8], ["roof_length", 4], ["turret_names", ["kulas", "kanon", "OtocVez"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['ChieftainMK9A',    'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK9D',    'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK9R',    'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK9CATC', 'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['ChieftainMK10', 'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['ChieftainMK11', 'ChieftainMK9', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11CATC',  'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11B',     'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11D',     'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11C',     'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11E',     'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ChieftainMK11Kaput', 'ChieftainMK11', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["Challenger1",	[["length",  6.1], ["width", 3.2], ["forward_offset", 1.9], ["hull_height", 1.5], ["bumper_height", 0.9], ["roof_height", 1.8], ["roof_length", 4], ["turret_names", ["kulas", "kanon", "OtocVez"]], ["turret_rotation", 150] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['Challenger1CATCNB',  'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1DRUM',    'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1EX',      'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1EXD',     'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1NB',      'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1NOSKIRT', 'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1REAR',    'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger1REARD',   'Challenger1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["Challenger2",	[["length",  6.6], ["width", 3.2], ["forward_offset", 1.9], ["hull_height", 1.5], ["bumper_height", 0.9], ["roof_height", 1.8], ["roof_length", 4], ["turret_names", ["kulas", "OtocVez"]], ["turret_rotation", 150] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['Challenger2A',  'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2AA', 'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2B',  'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2C',  'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2CC', 'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2D',  'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['Challenger2R',  'Challenger2', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;



['DAF_Leopard_2A6', 'BWMod_Leopard_2A6', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['DAF_Leopard_2A6_Desert', 'DAF_Leopard_2A6', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_StuGIII_G_Late_WH', [["length",  5.5], ["width", 2.9], ["forward_offset", 2.0], ["hull_height", 1.5], ["hull_length", 2.0], ["roof_length", 4.0], ["roof_height", 2.0], ["bumper_height", 1.2] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_StuGIII_G_Late_Skirt_WH', 'I44_Tank_G_StuGIII_G_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_StuGIII_G_Late_SS', 'I44_Tank_G_StuGIII_G_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_StuGIII_G_Late_Skirt_SS', 'I44_Tank_G_StuGIII_G_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_StuH42_G_WH', [["length",  4.5], ["width", 2.9], ["forward_offset", 2.0], ["hull_height", 1.5], ["hull_length", 2.0], ["roof_length", 4.0], ["roof_height", 2.0], ["bumper_height", 1.2] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_StuH42_G_Skirt_WH', 'I44_Tank_G_StuH42_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_StuH42_G_SS', 'I44_Tank_G_StuH42_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_StuH42_G_Skirt_SS', 'I44_Tank_G_StuH42_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_JaPz38_T_WH', [["length",  5.0], ["width", 2.3], ["forward_offset", 2.1], ["hull_height", 1.6], ["bumper_height", 0.9]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_JaPz38_T_WH_Winter', 'I44_Tank_G_JaPz38_T_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_JaPz38_T_SS', 'I44_Tank_G_JaPz38_T_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_JaPz38_T_SS_Winter', 'I44_Tank_G_JaPz38_T_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


['I44_Tank_G_PzKpfwII_F_WH', [["length", 4.5], ["width", 2.0], ["forward_offset", 1.6], ["hull_height", 1.3], ["roof_height", 1.5], ["roof_length", 3.5], ["bumper_height", 0.6]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_PzKpfwII_F_SS', 'I44_Tank_G_PzKpfwII_F_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_PzKpfwIV_D_WH', [["length",  5.5], ["width", 2.6], ["forward_offset", 2.65], ["hull_height", 1.5], ["roof_height", 1.7], ["roof_length", 4.2], ["bumper_height", 0.7], ["turret_names", ["Turret_Main_MG"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_PzKpfwIV_D_SS', 'I44_Tank_G_PzKpfwIV_D_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwIV_G_WH', 'I44_Tank_G_PzKpfwIV_D_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwIV_G_SS', 'I44_Tank_G_PzKpfwIV_D_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwIV_G_Skirt_WH', 'I44_Tank_G_PzKpfwIV_D_WH', [["width", 2.8], ["hull_height", 1.6], ["roof_height", 1.9]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwIV_G_Skirt_SS', 'I44_Tank_G_PzKpfwIV_G_Skirt_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_PzKpfwV_G_WH',            [["length",  6.5], ["width", 3.1], ["forward_offset", 2.9], ["hull_height", 1.7], ["hull_length", 3.0], ["roof_length", 6.0], ["roof_height", 2.1], ["bumper_height", 1.2], ["turret_names", ["Turret_Main_MG"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_PzKpfwV_G_camo_WH', 'I44_Tank_G_PzKpfwV_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwV_G_SS', 'I44_Tank_G_PzKpfwV_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwV_G_Camo_SS', 'I44_Tank_G_PzKpfwV_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwV_G_SS_Winter', 'I44_Tank_G_PzKpfwV_G_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_PzKpfwVI_E_Late_WH', [["length",  6.0], ["width", 3.2], ["forward_offset", 1.9], ["hull_height", 1.8], ["hull_length", 3.0], ["roof_length", 6.0], ["roof_height", 2.0], ["bumper_height", 0.9], ["turret_names", ["Turret_Main_MG"]], ["turret_rotation", 170] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_PzKpfwVI_E_Late_Camo_WH', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_AAMG_WH', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_AAMG_Camo_WH', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_SS', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_AAMG_SS', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_SS_Winter', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_AAMG_SS_Winter', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_WH_Winter', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_E_Late_AAMG_WH_Winter', 'I44_Tank_G_PzKpfwVI_E_Late_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Tank_G_PzKpfwVI_B_WH', [["length",  7.3], ["width", 3.6], ["forward_offset", 2.1], ["hull_height", 1.9], ["hull_length", 3.0], ["roof_length", 6.0], ["roof_height", 2.15], ["bumper_height", 1.1], ["turret_names", ["Turret_Main_MG"]], ["turret_rotation", 170] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_Tank_G_PzKpfwVI_B_SS', 'I44_Tank_G_PzKpfwVI_B_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_B_WH_Winter', 'I44_Tank_G_PzKpfwVI_B_WH', [["width", 3.4]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_Tank_G_PzKpfwVI_B_SS_Winter', 'I44_Tank_G_PzKpfwVI_B_WH_Winter', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


// IFVs tracked
['M2A2_EP1', 		         [["length",  6.0], ["width", 3.3], ["forward_offset", 4.0], ["hull_height", 2.2], ["bumper_height", 1.2], ["turret_names", ["kulas", "OsaVelitele"]]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['M6_EP1', 'M2A2_EP1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['M2A3_EP1', 'M2A2_EP1', [["width", 3.5], ["forward_offset", 3.2]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['cwr2_M2A2',              [["length",  6.0], ["width", 2.9], ["forward_offset", 6.9], ["hull_height", 1.8], ["hull_length", 1.8], ["roof_height", 2.1], ["roof_length", 4.8], ["bumper_height", 1.1], ["side_offset", 0.3], ["turret_names", ["OsaVelitele", "konec hlavne"]], ["turret_rotation", 90] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;

['BAF_FV510_W', 		     [["length",  7.0], ["width", 3.6], ["forward_offset", 3.0], ["hull_height", 2.2], ["bumper_height", 1.2] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BAF_FV510_D', 'BAF_FV510_W', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["BWMod_Marder_1A5",        [["length",  6.5], ["width", 3.0], ["forward_offset", 3.1], ["hull_height", 1.75], ["hull_length", 3], ["roof_height", 2.1], ["roof_length", 4.5], ["bumper_height", 1.0], ["turret_names", ["mainTurret"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BWMod_Marder_1A5_Desert', 'BWMod_Marder_1A5', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["p85_marder1",		         [["length",  6.5], ["width", 3.0], ["forward_offset", 2.9], ["hull_height", 1.75], ["hull_length", 3], ["roof_height", 2.2], ["roof_length", 4.5], ["bumper_height", 1.0], ["turret_names", ["OtocVez", "OsaVelitele"]]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_marder12', 'p85_marder1', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
["p85_scimtar",		         [["length",  4.5], ["width", 2.3], ["side_offset", 0.25], ["forward_offset", 4.6], ["hull_height", 1.2], ["hull_length", 2], ["roof_height", 1.5], ["roof_length", 4]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_scorpion', 'p85_scimtar', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_BRADLEY',              [["length",  6.0], ["width", 2.9], ["forward_offset", 3.8], ["hull_height", 1.8], ["hull_length", 1.8], ["roof_height", 2.1], ["roof_length", 4.8], ["bumper_height", 1.1], ["turret_names", ["OsaVelitele", "kanon", "konec hlavne"]], ["turret_rotation", 90] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_BRADLEY_Green', 'p85_BRADLEY', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_BRADLEY_merdc', 'p85_BRADLEY', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_BRADLEY_99', 'p85_BRADLEY', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['warrior',  [["length",  6.0], ["width", 2.7], ["side_offset", 0.7], ["forward_offset", 3.0], ["hull_height", 1.8], ["bumper_height", 1.05], ["roof_height", 2.0], ["roof_length", 4], ["turret_names", ["kulas", "OtocVez"]], ["turret_rotation", 150]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['warrior1',  'warrior', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['warrior2',  'warrior', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['warrior5',  'warrior', [["width", 2.9]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['Scimitar',  [["length",  4.5], ["width", 2.1], ["side_offset", 0.6], ["forward_offset", 4.5], ["hull_height", 1.2], ["hull_length", 2], ["bumper_height", 0.6], ["roof_height", 1.5], ["roof_length", 3], ["turret_names", ["OtocVez"]], ["turret_rotation", 150]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['ScimitarD',  'Scimitar', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['Scorpion',  'Scimitar', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['ScorpionD',  'Scorpion', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

["sfp_strf90c", [["length",  6.5], ["width", 3.3], ["forward_offset", 3.5], ["hull_height", 1.7], ["hull_length", 3], ["roof_height", 2.1], ["roof_length", 6.0], ["bumper_height", 0.9], ["turret_names", ["mainTurret", "OsaVelitele"]], ["turret_rotation", 270] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['sfp_strf9040c_desert', 'sfp_strf90c', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['sfp_strf90d', 'sfp_strf90c', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['sfp_lvkv90c', 'sfp_strf90c', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['vil_cv90_NL',             [["length",  6.0], ["width", 2.85], ["forward_offset", 2.9], ["hull_height", 1.4], ["hull_length", 2.0], ["roof_height", 1.85], ["roof_length", 5.5], ["bumper_height", 0.7], ["turret_names", ["OtocVez", "OsaVeze"]], ["turret_rotation", 135] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;

// APCs tracked
['p85_m113_redef',           [["length",  5.1], ["width", 2.4], ["side_offset", 0.1], ["forward_offset", 2.3], ["hull_height", 2.0], ["bumper_height", 1.0]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_m113Green_redef', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_m113Merdc_redef', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_m113german_redef', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_m113old', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['p85_AIFV_mg_base',         [["length",  5.2], ["width", 2.4], ["forward_offset", 2.3], ["hull_height", 1.8], ["hull_length", 1.8], ["roof_height", 2.0], ["roof_length", 4.0], ["bumper_height", 0.8]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_AIFV_ifv_base', 'p85_AIFV_mg_base', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_m577hq', 'p85_m113_redef', [["roof_height", 2.7], ["roof_length", 4], ["hull_length", 0]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_bulldog', 	         [["length",  5.7], ["width", 2.4], ["forward_offset", 2.7], ["hull_height", 2.0], ["bumper_height", 1.0]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;

['cwr2_M113_HQ', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['cwr2_FV432',           [["length",  5.1], ["width", 2.3], ["side_offset", 0.0], ["forward_offset", 2.3], ["hull_height", 1.8], ["bumper_height", 1.0], ["roof_height", 2.0], ["roof_length", 4]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['cwr2_FV432_HQ', 'cwr2_FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['FV432',  [["length",  5.1], ["width", 2.3], ["side_offset", 0.6], ["forward_offset", 2.5], ["hull_height", 1.8], ["bumper_height", 1.0], ["roof_height", 2.0], ["roof_length", 4]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['FV432CATC',  'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV432A',     'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV432ACATC', 'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV432S',     'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV432SD',    'FV432', [["forward_offset", 4.3]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV432SCATC', 'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV438',      'FV432', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV434',      'FV432', [["forward_offset", 2.7], ["length",  5.5]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['FV434CATC',  'FV434', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['Spartan',  [["length",  4.5], ["width", 2.0], ["forward_offset", 2.3], ["hull_height", 1.3], ["bumper_height", 0.7], ["roof_height", 1.8], ["roof_length", 3.5]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['Spartan1',  'Spartan', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['SpartanD',  'Spartan', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


['vil_aifv_mg_NL', 'p85_AIFV_mg_base', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['vil_aifv_ifv_NL', 'vil_aifv_mg_NL', [["turret_names", ["OtocVez", "OsaVeze"]], ["turret_rotation", 270]] ] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

// Artillery tracked
["p85_M109palladin", 			 [["length",  6.5], ["width", 2.8], ["forward_offset", 1.5], ["hull_height", 1.8], ["bumper_height", 0.9], ["turret_names", ["OtocVez", "OtocVez_2"]], ["turret_rotation", 180] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['p85_M109palladin_de', 'p85_M109palladin', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

// APCs wheeled
['LAV25', 		     		 [["length",  5.8], ["width", 2.2], ["side_offset", 0.2], ["forward_offset", 2.9], ["hull_height", 1.9], ["hull_length", 2.0], ["bumper_height", 1.3], ["roof_length", 5.5], ["roof_height", 2.2], ["turret_names", ["OtocVez", "OtocHlaven"]]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['LAV25_HQ', 'LAV25', [["roof_height", 2.6]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['BWMod_Fuchs', 		     [["length",  6.8], ["width", 2.5], ["forward_offset", 3.2], ["hull_height", 1.7], ["hull_length", 2.0], ["roof_length", 6.0], ["roof_height", 2.4]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BWMod_Fuchs_Desert', 'BWMod_Fuchs', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['BWMod_Fuchs_ArmoredTurret_Desert', 'BWMod_Fuchs', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['sfp_patgb203', 		     [["length",  6.8], ["width", 2.4], ["forward_offset", 3.2], ["hull_height", 1.9], ["hull_length", 3.0], ["roof_length", 6.0], ["roof_height", 2.7]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['sfp_patgb203_ksp58', 'sfp_patgb203', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['daf_patgb203',             [["length",  7.0], ["width", 2.4], ["forward_offset", 3.4], ["hull_height", 2.0], ["hull_length", 1.3], ["roof_height", 2.5], ["roof_length", 5.7], ["bumper_height", 1.4]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['daf_patgb203_ksp58', 'daf_patgb203', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['daf_patgb203', 'daf_patgb203', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['DAF_Fuchs_BAT', 'BWMod_Fuchs', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['DAF_Fuchs_BAT_Desert', 'DAF_Fuchs_BAT', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


// AA vehicles
['p85_vulcan', 'p85_m113_redef', [["width", 2.6], ["turret_names", ["OtocVez"]], ["turret_rotation", 180]]] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['p85_chaparel',             [["length",  5.3], ["width", 2.4], ["forward_offset", 3.4], ["roof_height", 1.5], ["roof_length", 3.5], ["bumper_height", 0.9]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;

['cwr2_M163', 'p85_m113_redef', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['BWMod_Wiesel2_Ozelot', 	[["length",  4.5], ["width", 1.9], ["forward_offset", 2.2], ["hull_height", 1.3], ["hull_length", 3], ["roof_height", 1.6], ["roof_length", 3.5], ["turret_names", ["mainTurret"]] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BWMod_Wiesel2_Ozelot_Desert', 'BWMod_Wiesel2_Ozelot', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


// ATGM / recon wheeled vehicles
['BAF_Jackal2_GMG_D', 	     [["length",  5.5], ["width", 2.0], ["side_offset", -0.2], ["forward_offset", 2.9], ["hull_height", 1.7], ["hull_length", 1.5], ["roof_height", 2.1], ["roof_length", 4.0], ["bumper_height", 1.0]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['BAF_Jackal2_L2A1_D', 'BAF_Jackal2_GMG_D', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['BAF_Jackal2_GMG_W', 'BAF_Jackal2_GMG_D', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['BAF_Jackal2_L2A1_W', 'BAF_Jackal2_GMG_W', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['FOX',                     [["length",  4.0], ["width", 1.8], ["forward_offset", 2.0], ["hull_height", 1.4], ["hull_length", 1.5], ["roof_height", 1.8], ["roof_length", 3.5], ["bumper_height", 0.8], ["turret_names", ["OsaVelitele"]] ]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['FOX1', 'FOX', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['DDAM_240GD', [["length",  4.3], ["width", 1.5], ["forward_offset", 2.1], ["hull_height", 1.3], ["hull_length", 1.5], ["roof_height", 1.4], ["roof_length", 2.7]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['DDAM_240GD_Cam1',   'DDAM_240GD', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['DDAM_240GDGUN',     'DDAM_240GD', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['DDAM_240GDGUN_Des', 'DDAM_240GD', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;


// Static guns
['I44_GunAT_G_PaK40_WH', [["length",  1.0], ["width", 1.5], ["forward_offset", 0.7], ["hull_height", 0.6], ["bumper_height", 0.5], ["turret_names", ["Turret_Main_Spin"]]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_GunAT_G_PaK40_SS', 'I44_GunAT_G_PaK40_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_GunAT_G_PaK40_SS_W', 'I44_GunAT_G_PaK40_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_GunAT_G_PaK40_Pintle_WH', 'I44_GunAT_G_PaK40_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;
['I44_GunAT_G_PaK40_Pintle_SS', 'I44_GunAT_G_PaK40_WH', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_GunAA_G_FlaK36_Pintle_WL', [["length",  2.0], ["width", 1.5], ["forward_offset", 1.5], ["hull_height", 1.2], ["bumper_height", 1.0], ["turret_names", ["hatch_commander"]], ["turret_rotation", 90]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;
['I44_GunAA_G_FlaK36_Pintle_AT_WL', 'I44_GunAA_G_FlaK36_Pintle_WL', []] call PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample;

['I44_Gun_G_leFH18_WH', [["length",  1.0], ["width", 1.5], ["forward_offset", 0.7], ["hull_height", 0.6], ["bumper_height", 0.5], ["turret_names", ["Turret_Main_Spin"]], ["turret_rotation", 200]]] call PLAN_foliage_camouflage_system_fnSetVehicleData;

For those interested in (improving) the implementation, you'll find the source code at dev.withsix.com/projects/folcams/repository (requires dev.withsix.com account to see the source code).

William

Edited by _William
Update to 1.0.0

Share this post


Link to post
Share on other sites

Brilliant! I was thinking about implementing this kind of camouflage in our mod too many times already (vehicles, artillery, fortifications, even for use on helmet covers). This looks like a dream coming true! :D

Share this post


Link to post
Share on other sites

Finally! Just this morning I woke to regret the difficulties of making foilage camo in Arma. Do please keep working on this, it's something we'd very much like to see.

Share this post


Link to post
Share on other sites

This is really sweet! I hope to see multiplayer functionality for this, that would be awesome. Keep up the great work!

Share this post


Link to post
Share on other sites

Nice, good work.

Great implementation of the idea aswell. :)

Share this post


Link to post
Share on other sites

Best post the script code for review and comments

Share this post


Link to post
Share on other sites

Good point, Kju. Please find below the scripts (some code irrelevant for MP removed for brevity):

The code is set-up as follows:

- config.cpp (invokes scripts/init.sqf)

- scripts/init.sqf (invokes initialization script, checks for (synchronized) vehicles, invokes scripts/attach_foliage.sqf for each vehicle after a delay to allow missions to add vehicle data)

- scripts/attach_foliage.sqf (checks if the vehicle is known, if so invokes scripts/vehicle_attach_foliage.sqf and receives a list of foliage objects, and invokes scripts/monitor_vehicle_foliage.sqf to rotate and remove the foliage objects from the vehicle)

- scripts/vehicle_attach_foliage.sqf (attaches foliage, returns list of all attached foliage and a list of turret attached foliage)

- scripts/monitor_vehicle_foliage.sqf (monitors vehicle being alive, and rotates any turret attached foliage between every 0.05 and 1.0 second, depending on distance to player / movie maker override)

- scripts/initialize_foliage_camouflage_system.sqf (sets up the globals, defines functions to handle vehicle and foliage data)

I'm aware I'd need to perform an additional setPos in order to communicate rotation of the turret attached foliage in the 'monitor' script for MP purposes. Checking if the angle hasn't changed significantly also might help. However, SP performance is good.

Looking forward to everyone's feedback. In case you need to have this code running on your system to improve it, let me know and I'll send you a .pbo.

William

config.cpp

[...]
class CfgVehicles
{
class Logic;
class PLAN_FoliageCamouflageSystem_Conifer_Module : Logic
{
	version = 0.1;
	displayName = "Foliage Camouflage: Conifer";
	icon = "plan_foliage_camouflage_system\ui\icon.paa";
	picture = "plan_foliage_camouflage_system\ui\icon.paa";
	vehicleClass = "Modules";
	class Eventhandlers
	{
		init = "nul = [_this select 0, 'Conifer'] execVM 'plan_foliage_camouflage_system\scripts\init.sqf';";
	};
};
[...]

scripts/init.sqf

private ["_module", "_foliage_type", "_vehicles", "_debug", "_script"];
sleep .1;
_module       = _this select 0;
_foliage_type = _this select 1;

// Initialize foliage camouflage system, if necessary
if ( isnil("PLAN_foliage_camouflage_system") ) then
{
[] execVM "plan_foliage_camouflage_system\scripts\initialize_foliage_camouflage_system.sqf";
waitUntil { sleep 0.1; !isnil("PLAN_foliage_camouflage_system") };
};

// Sleep for several seconds allowing mission creators to add vehicle data from the mission's init.sqf
sleep 3;

// Retrieve synchronized vehicles.
_vehicles = [];
if ( count (synchronizedObjects _module) == 0 ) then
{ 
_vehicles = vehicles;
}
else
{
{ _vehicles set [count _vehicles, vehicle _x]; } forEach (synchronizedObjects _module);
};

// Camouflage these vehicles (one-by-one to reduce CPU/network load, and to make debug output easier to read).
{
private ["_script"];
_script = [_x, _foliage_type] execVM "plan_foliage_camouflage_system\scripts\attach_foliage.sqf";
waitUntil { scriptDone _script };
} forEach _vehicles;

scripts/attach_foliage.sqf

private ["_vehicle", "_foliage_class", "_debug", "_script"];

_vehicle       = _this select 0;
_foliage_class = _this select 1;

// Bail out if we're not the server
if (!isServer) exitWith {};

// Retrieve foliage data
private ["_foliage_data"];
_foliage_data = [...]


// Retrieve vehicle data
private ["_vehicle_data", "_attach_fn", "_monitor_fn"];
_vehicle_data = [typeOf _vehicle] call PLAN_foliage_camouflage_system_fnGetVehicleData;
_attach_fn    = compile preprocessFileLineNumbers "plan_foliage_camouflage_system\scripts\vehicle_attach_foliage.sqf";
_monitor_fn   = compile preprocessFileLineNumbers "plan_foliage_camouflage_system\scripts\monitor_vehicle_foliage.sqf";

if ( count _vehicle_data > 0 ) then 
{
private ["_foliageData", "_foliage", "_turretFoliageInfo"];
_foliageData       = [_vehicle, _vehicle_data, _foliage_data] call _attach_fn;
_foliage           = _foliageData select 0;
_turretFoliageInfo = _foliageData select 1;
if ( count _foliage > 0 ) then
{
	[_vehicle, _foliage, _turretFoliageInfo] spawn _monitor_fn;
};
}
else
{
if ( _debug > 10 ) then { diag_log format(["%1: [%3, %4] execVM '%2' - no data for vehicle type %5", time, _script, _vehicle, _foliage_class, typeOf _vehicle]); };
};

scripts/vehicle_attach_foliage.sqf

private ["_vehicle", "_vehicle_data", "_foliage_data", "_debug", "_script"];
_vehicle       = _this select 0;
_vehicle_data  = _this select 1;
_foliage_data  = _this select 2;

// Extract foliage data
private ["_foliage_type", "_fol_height", "_fol_width", "_fol_trunk_height", "_fol_trunk_offset", "_fol_orientation"];
_foliage_type     = _foliage_data select 0;
_fol_height       = _foliage_data select 1;
_fol_width        = _foliage_data select 2;
_fol_trunk_height = _foliage_data select 3;
_fol_trunk_offset = _foliage_data select 4;
_fol_orientation  = _foliage_data select 5;

// Extract vehicle data

private ["_length", "_width", "_hull_height", "_forward_offset", "_bumper_height", 
        "_roof_height", "_roof_length", "_hull_length", "_side_offset", "_turret_names", "_turret_rotation"];
_length          = _vehicle_data select 0;
_width           = _vehicle_data select 1;
_forward_offset  = _vehicle_data select 2;
_hull_height     = _vehicle_data select 3;	
_bumper_height   = _vehicle_data select 4;
_roof_height     = _vehicle_data select 5;
_roof_length     = _vehicle_data select 6;
_hull_length     = _vehicle_data select 7;
_side_offset     = _vehicle_data select 8;
_turret_names    = _vehicle_data select 9;
_turret_rotation = _vehicle_data select 10;

// Set _side_offset to 0 if not given
if ( isnil {_side_offset} ) then { _side_offset = 0.0; };										 

// Helper functions
private ["_fnUniformDistribution"];
_fnUniformDistribution = compile "random(2 * _this) - _this";


private ["_attachments"];
_attachments = [];
private ["_nearZero"];
_nearZero = 0.0001;

private ["_vehicle_z"];
_vehicle_z = (_vehicle modelToWorld [0,0,0]) select 2;

// Attach foliage to both sides of the hull, starting from the front.
// Still to do: account for sloping front hull
if ( !isnil("_hull_height") ) then
{
private ["_y"];
for [{_y = 0.0}, {_y < (_hull_length - _fol_width)}, {_y = _y + _fol_width}] do
{
	private ["_sy", "_sz"];
	_sy =  _forward_offset - _fol_width/2 - _y;
	_sz = _hull_height + _fol_trunk_height - _fol_height - _vehicle_z;
	{
		private ["_foliage", "_side", "_sx"];
		_side = _x;
		_sx   = _side * (_width/2 - _fol_trunk_offset) + _side_offset;

		// Create a new plant
		if (random(1) < 0.95) then
		{
			_foliage = _foliage_type createVehicle [0, 0, 0];
			_attachments set [count _attachments, _foliage];

			private ["_angle_noise", "_x_noise", "_y_noise", "_z_noise", "_p_noise"];
			_angle_noise = 15 call _fnUniformDistribution;
			_x_noise     = (10 call _fnUniformDistribution) / 100;
			_y_noise     = ( 3 call _fnUniformDistribution) / 100;
			_z_noise     = ( 4 call _fnUniformDistribution) / 100;
			_p_noise     = random(10) / 100;
			// Attach it to the vehicle's side
			_foliage attachTo [_vehicle, [_sx + _x_noise, _sy + _y_noise, _sz + _z_noise]];
			// Rotate the plant to its best orientation
			_foliage setDir (_fol_orientation + _angle_noise + (_side * 90));
			// Flip it upside down
			_foliage setVectorUp [_p_noise * _side, _nearZero, -1.0];
		};
	} forEach [-1, 1];
};
};

// Attach foliage to both sides of the roof, starting from the back.
if ( !isnil("_roof_height") && !isnil("_roof_length") ) then
{
private ["_y"];
for [{_y = 0.0}, {_y < (_roof_length - _fol_width)}, {_y = _y + _fol_width}] do
{
	private ["_sy", "_sz"];
	_sy =  _length * -1 + _forward_offset + _fol_width/2 + _y;
	_sz = _roof_height + _fol_trunk_height - _fol_height - _vehicle_z;
	{
		private ["_foliage", "_side", "_sx"];
		_side = _x;
		_sx   = _side * (_width/2 - _fol_trunk_offset) + _side_offset;

		// Create a new plant
		if (random(1) < 0.95) then
		{
			_foliage = _foliage_type createVehicle [0, 0, 0];
			_attachments set [count _attachments, _foliage];

			private ["_angle_noise", "_x_noise", "_y_noise", "_z_noise", "_p_noise"];
			_angle_noise = 15 call _fnUniformDistribution;
			_x_noise     = (10 call _fnUniformDistribution) / 100;
			_y_noise     = ( 3 call _fnUniformDistribution) / 100;
			_z_noise     = ( 4 call _fnUniformDistribution) / 100;
			_p_noise     = random(10) / 100;
			// Attach it to the vehicle's side
			_foliage attachTo [_vehicle, [_sx + _x_noise, _sy + _y_noise, _sz + _z_noise]];
			// Rotate the plant to its best orientation
			_foliage setDir (_fol_orientation + _angle_noise + (_side * 90));
			// Flip it upside down
			_foliage setVectorUp [_p_noise * _side, _nearZero, -1.0];
		};
	} forEach [-1, 1];
};
};


// Attach foliage to the front bumper horizontally (hence the use of _fol_height).
// To do: ensure the foliage is aligned from the center
if ( !isnil("_bumper_height") ) then
{
private ["_i", "_branches", "_branch_spacing"];
_branches = floor(_width / (_fol_height - _fol_trunk_height));
if ( _branches > 1 ) then
{
	_branch_spacing = (_width - (_fol_height - _fol_trunk_height)) / (_branches - 1);
}
else
{
	_branch_spacing = 0;
};

for [{_i = 0}, {_i < _branches}, {_i = _i + 1}] do
{
	private ["_sx", "_sy", "_sz"];
	_sx = (_i - ((_branches-1)/2)) * _branch_spacing + _fol_height/2 + _side_offset;
	_sy = _forward_offset - _fol_trunk_offset;
	_sz = _bumper_height - _vehicle_z;

	private ["_angle_noise", "_x_noise", "_y_noise", "_z_noise", "_p_noise"];
	_angle_noise =  30 call _fnUniformDistribution;
	_x_noise     = (10 call _fnUniformDistribution) / 100;
	_y_noise     = ( 3 call _fnUniformDistribution) / 100;
	_z_noise     = ( 4 call _fnUniformDistribution) / 100;
	_p_noise     = (10 call _fnUniformDistribution) / 100;

	// Create a new plant
	private ["_foliage"];
	_foliage = _foliage_type createVehicle [0, 0, 0];
	_attachments set [count _attachments, _foliage];

	// Attach it to the vehicle's side
	_foliage attachTo [_vehicle, [_sx + _x_noise, _sy + _y_noise, _sz + _z_noise]];
	// Rotate the plant to its best orientation
	_foliage setDir (_fol_orientation + _angle_noise + 150);
	// Align it with the x-axis
	_foliage setVectorUp [1.0, _nearZero, _p_noise];
};
};

// Attach foliage to the turret
private ["_turret_attachments"];
_turret_attachments = [];
if ( !isnil("_turret_names") ) then
{
{
	private ["_foliage"];
	_foliage = _foliage_type createVehicle [0, 0, 0];
	_attachments        set [count _attachments, _foliage];
	_turret_attachments set [count _turret_attachments, [_foliage, _turret_rotation]];

	// Attach it to the given memory point, and run a script later to keep the foliage aligned with the main weapon direction
	_foliage attachTo [_vehicle, [0, 0, 0.25], _x];		
} forEach _turret_names;
};

[_attachments, _turret_attachments]

scripts/monitor_vehicle_foliage.sqf

private ["_vehicle", "_foliage", "_turretFoliage", "_debug", "_script"];
_vehicle       = _this select 0;
_foliage       = _this select 1;
_turretFoliage = _this select 2;

// Wait until there's player to see the foliage
waitUntil {!isNull player};

private ["_operational", "_health"];
_operational = true;
_health      = damage _vehicle;
while { _operational } do
{
private["_distanceToPlayer", "_updateDelay"];
_distanceToPlayer = player distance _vehicle;
_updateDelay      = (_distanceToPlayer - 200.0) / 1000.0;
_updateDelay      = (0.05 max _updateDelay) min PLAN_foliage_camouflage_system_max_update_delay;
sleep _updateDelay;

// Keep turret foliage aligned with turret
private ["_rotation", "_hullRotation", "_weapons"];
_hullRotation = getDir _vehicle;
_weapons      = weapons _vehicle;
if ( count _weapons > 0 ) then
{
	private ["_weaponDir"];
	_weaponDir = _vehicle weaponDirection (_weapons select 0);
	_rotation  = ((_weaponDir select 0) atan2 (_weaponDir select 1));
}
else
{
	_rotation = (_vehicle animationPhase "mainTurret") * -180.0 / 3.14159;
};
_rotation = _rotation - _hullRotation;

{
	private ["_f", "_delta_rotation"];
	_f              = _x select 0;
	_delta_rotation = _x select 1;
	_f setDir (_rotation + _delta_rotation);
} forEach _turretFoliage;

// Remove foliage when the vehicle is destroyed
if ( !alive(_vehicle)) then 
{
	{ deleteVehicle _x; } forEach _foliage;
	_operational = false;
};
};

- scripts/initialize_foliage_camouflage_system.sqf

// Bail out if we're not the server
if (!isServer) exitWith {};


PLAN_foliage_camouflage_system_fnInterpretVehicleData = compile [...]
PLAN_foliage_camouflage_system_fnGetVehicleData = compile [...]
PLAN_foliage_camouflage_system_fnSetVehicleData = compile [...]
PLAN_foliage_camouflage_system_fnSetVehicleDataUsingExample = compile [...]
PLAN_foliage_camouflage_system_fnSetMaxUpdateDelay = compile '
private ["_maxDelay"];
_maxDelay = _this;
PLAN_foliage_camouflage_system_max_update_delay = _maxDelay;
';


// Set-up and load vehicle dimensions database
if ( isNil("PLAN_foliage_camouflage_system_vehicle_database") ) then
{
private ["_script"];
_script = [] execVM "plan_foliage_camouflage_system\scripts\vehicle_database.sqf";
waitUntil { scriptDone _script };
};

// Global max update delay in seconds, defaults to 1.0 for far vehicles
PLAN_foliage_camouflage_system_max_update_delay = 1.0;

// Define a global so scripts can wait for the system to be up.
PLAN_foliage_camouflage_system = true

Edited by _William
Spelling

Share this post


Link to post
Share on other sites

Looks pretty good already. :)

Thoughts

# Use killedEH instead of the loop (setVar/getVar to cache the data per vehicle)

# As addon you would have initEH (with CBA also preInit , etc)

# You seem to have a DB or cache the vehicle dimensions already; otherwise may help a bit

# Adjusting the foliage per turret movement should be optional as it seems its loop is the biggest performance drain (aside from drawing additional alpha textures and foliage objects)

# Vehicle respawn and dynamic vehicle creation is not taken into account (unless i missed it); the said initEH would make your life far easier there

Did you do some performance measurements yet?

Edited by .kju [PvPscene]

Share this post


Link to post
Share on other sites

Awesome! Especially the ease of use is intriguing! *thumbsup*

Do you also plan different plants and/or a mix with camo netting (e.g. putting a few dry brushes on a desert vehicles would make sense as well)? And what about infantry, i.e. helmet cover?

Share this post


Link to post
Share on other sites

Thanks for all the encouragements and feedback (here and in the PMs - Rocko sent some great info and sample code to handle viewblocks).

No CWR2 Challenger support ? :(

The vehicle database currently covers 133 vehicles, including BI's USMC armor, P85 UK, US and FRG (Bundeswehr) armor, CWR2 US and UK armor (including the Chally - yes), all of I44's Wehrmacht/SS/Luftwaffe armor and static guns, modern Bundeswehr armor, some modern Dutch and Swedish armor. I just need to complete my 'homework' on Trouble's BAOR vehicles, having done little more than the Mk9 Chieftains.

Awesome! Especially the ease of use is intriguing! *thumbsup*

Do you also plan different plants and/or a mix with camo netting (e.g. putting a few dry brushes on a desert vehicles would make sense as well)? And what about infantry, i.e. helmet cover?

No plans for helmet covers. Perhaps the video was confusing, showing the CWR2 British infantry with scrim/burlap attached to their helmets. These attachments are part of the excellent soldier models, by Col Stagler.

Wrt different plants: the system is set-up to support different "plants" just like it supports different vehicles. Up to now, I've only discovered one plant producing decent results; others are too small or too bulky, as you can see for yourself below. Using anything else than plants is possible, but requires more precision in placement to look good.

First priority is to get one type of foliage working well.

_foliage_pmugo.jpg _foliage_sambucus.jpg _foliage_longdrygrass.jpg _foliage_tyres.jpg

Left to right: PMugo plant (that works OK when its stuffed for a large part into the vehicle), Sambucus (too wield, roots too long), long tall grass (too small to be effective), and car tyres (to show something different than plants).

William

Share this post


Link to post
Share on other sites
This looks great!, whats the status on this anything that can be used yet? I was wondering if anything like this could be done with the 'rags' you see in the pic below:

http://data3.primeportal.net/apc/erik_jan_eskes/cv9035nl_camo/images/cv9035nl_camo_3_of_9.jpg

I'm preparing for a release this week, including source code and extensive documentation. Dutch Army Mod CV9035NL and YPRs are covered (duh).

If you have a model for the "fabric strips" camo net (say 1m wide, 0.7m high, 0.15m deep), FolCamS would be able to attach it to the hull sides and front right away.

Unless the vehicle has memory points at the turret sides, FolCamS isn't able to attach anything to the turret sides. (The Iron Front: Liberation 1944 Wehrmacht tanks have track parts and side skirts attached using a series of memory points).

The Arma2 attach_to command is limited to either the vehicle center with an offset, or a (rotating) memory point but without an offset.

If you need to add memory points to the CV model, you might be better off doing all the camouflage netting yourself. In a similar fashion as the Gepard (aka PRTL with different radar dish) you have in the Dutch Army mod.

Anyway, if you have a camo net model, I'll be more than happy to help out recreating these fine IFVs.

William

Share this post


Link to post
Share on other sites

Add on released. See updated first post. Enjoy!

Looking forward to your feedback,

William

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×