Call of Duty 5: Collision Brushes

From COD Modding & Mapping Wiki
Share/Save/Bookmark
Jump to: navigation, search

Nutshell.png This tutorial will explain how to spawn colliders onto models dynamically spawned in a Level. Thanks to Tally for the find!

Availaible Collision Brushes

Here is a list of the Collision Brushes from stock:

  • collision_geo_32x32x10
  • collision_geo_32x32x32
  • collision_geo_32x32x128
  • collision_geo_64x64x10
  • collision_geo_64x64x64
  • collision_geo_64x64x128
  • collision_geo_64x64x256
  • collision_geo_128x128x10
  • collision_geo_128x128x128
  • collision_geo_256x256x10
  • collision_geo_256x256x256
  • collision_geo_512x512x10
  • collision_geo_512x512x512
  • collision_geo_cylinder_32x128
  • collision_geo_ramp
  • collision_geo_sphere_32
  • collision_geo_sphere_64
  • collision_wall_32x32x10
  • collision_wall_64x64x10
  • collision_wall_128x128x10
  • collision_wall_256x256x10
  • collision_wall_512x512x10


Example

In the level GSC file for mp_airfield, add this:

        spawn_model( "test", "prop_flag_russian", (1886, 2493, 8), (0,0,0) );
	spawncollision( "collision_geo_32x32x128","collider",(1886, 2493, 8), (0,0,0) );

And add the spawn_model() method at the bottom of the GSC file:

spawn_model( name, model, origin, angles )
{
	if( !isdefined(model) || !isdefined(name) || !isdefined(origin) )
		return undefined;

	if( !isdefined(angles) )
		angles = (0,0,0);

	spawn = spawn ("script_model",(0,0,0));
	spawn.origin = origin;
	spawn setmodel (model);
	spawn.targetname = name;
	spawn.angles = angles;

	return spawn;
}

Full GSC for mp_airfield after this:

main()
{
	maps\mp\mp_airfield_fx::main();
	maps\mp\createart\mp_airfield_art::main();	

	maps\mp\_load::main();
	
	//maps\mp\mp_airfield_amb::main();

	maps\mp\_compass::setupMiniMap("compass_map_mp_airfield");

	// If the team nationalites change in this file,
	// you must update the team nationality in the level's csc file as well!
	game["allies"] = "marines";
	game["axis"] = "japanese";
	game["attackers"] = "axis";
	game["defenders"] = "allies";
	game["allies_soldiertype"] = "pacific";
	game["axis_soldiertype"] = "pacific";

	setdvar( "r_specularcolorscale", "1" );

	setdvar("compassmaxrange","2100");

	game["strings"]["war_callsign_a"] = &"MPUI_CALLSIGN_AIRFIELD_A";
	game["strings"]["war_callsign_b"] = &"MPUI_CALLSIGN_AIRFIELD_B";
	game["strings"]["war_callsign_c"] = &"MPUI_CALLSIGN_AIRFIELD_C";
	game["strings"]["war_callsign_d"] = &"MPUI_CALLSIGN_AIRFIELD_D";
	game["strings"]["war_callsign_e"] = &"MPUI_CALLSIGN_AIRFIELD_E";

	game["strings_menu"]["war_callsign_a"] = "@MPUI_CALLSIGN_AIRFIELD_A";
	game["strings_menu"]["war_callsign_b"] = "@MPUI_CALLSIGN_AIRFIELD_B";
	game["strings_menu"]["war_callsign_c"] = "@MPUI_CALLSIGN_AIRFIELD_C";
	game["strings_menu"]["war_callsign_d"] = "@MPUI_CALLSIGN_AIRFIELD_D";
	game["strings_menu"]["war_callsign_e"] = "@MPUI_CALLSIGN_AIRFIELD_E";

	
	// enable new spawning system
	maps\mp\gametypes\_spawning::level_use_unified_spawning(true);
	
	createSpawnpoint( "mp_ctf_spawn_allies", (2803, 2929, 42), 4 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (2736, 2869, 42), 270.6 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (4553, 2384, -34), 135 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (2649.5, 1903, 136), 227.1 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (3309.5, 1355.5, -21.5), 46.2 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (2364, 1611, 134), 47.1 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (2330, 1018, 33), 168.6 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (1840, 1518, 63), 212 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (1762, 942, 7), 150 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (1540, 694, -5), 152.7 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (1158, 655, 5), 99.3 ); 
	createSpawnpoint( "mp_ctf_spawn_allies", (3790, 2227.5, 10), 60 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1290, 5880, 188), 342.8 );
	createSpawnpoint( "mp_ctf_spawn_axis", (1680, 5834, 37), 291.8 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (949, 5739, 37), 0 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1322, 5428, 181), 240 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1616, 5376.5, 16), 290 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (2284, 5424, 28), 270 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (2934, 5259, 50), 318.6 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1412, 4865, 42), 281.8 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (2040, 4468, -78), 90 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (380, 4535, 34), 270 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (785, 4515, 16), 270 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1947, 4178, 1), 0 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1402, 4106, 26), 335.6 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1304, 3666, 13), 313.4 ); 
	createSpawnpoint( "mp_ctf_spawn_axis", (1771, 3295, 25), 231.2 );

        spawn_model( "test", "prop_flag_russian", (1886, 2493, 8), (0,0,0) );
	spawncollision( "collision_geo_32x32x128","collider",(1886, 2493, 8), (0,0,0) );
					
}

createSpawnpoint( classname, origin, yaw )
{
	spawnpoint = spawn( "script_origin", origin );
	spawnpoint.angles = (0,yaw,0);
	
	if ( !isdefined( level.extraSpawnpoints ) )
		level.extraSpawnpoints = [];
	if ( !isdefined( level.extraSpawnpoints[classname] ) )
		level.extraSpawnpoints[classname] = [];
	level.extraSpawnpoints[classname][ level.extraSpawnpoints[classname].size ] = spawnpoint;
}

spawn_model( name, model, origin, angles )
{
	if( !isdefined(model) || !isdefined(name) || !isdefined(origin) )
		return undefined;

	if( !isdefined(angles) )
		angles = (0,0,0);

	spawn = spawn ("script_model",(0,0,0));
	spawn.origin = origin;
	spawn setmodel (model);
	spawn.targetname = name;
	spawn.angles = angles;

	return spawn;
}

This gives you a solid Russian flag in mp_airfield which you cant walk through:

Solig flag.jpg