Creating Primitives

From Valve Developer Community

Your First Map
1. Getting Started
2. View Navigation
3. Basic Construction
4. Creating a Room
5. Applying Textures
6. Adding Entities
7. Adding Light
8. Adding Prop Models
9. Saving and Compiling

In Hammer, a Primitive is a relatively simple brush object. Primitives can be world geometry or interactive entities subject to physics & damage. In this example, we will create an interactive primitive, subject to physics & damage in the map: specifically, a 32 unit crate (http://www.oldmanmurray.com/features/39.html).


  1. Select the Block Tool and create a cube in your map.
  2. Open the Texture Browser and filter for dev crate. Dev/dev_measurecrate02 should be a 32x32 crate texture.
    Properly-sized cube with 32x32 texture.
    Enlarge
    Properly-sized cube with 32x32 texture.
  3. Apply the dev/dev_measurecrate02 texture to your cube.
    Image:note.png Note: If the grid on your 2D views is too large to get down to 32 units, press the [ key or click the Smaller Grid button Image:Hammer_SmallerGrid.png to create smaller objects on the grid.
  4. Resize your cube using the Selection Tool until the texture fits properly on the cube.
    Image:note.png Note: To this point, creating primitives for world geometry and for interactive objects is the same. In order to specify whether our crate is, indeed, world geometry or an interactive object, we must select it and move it either toWorld or toEntity.
    toEntity button (Ctrl+T)
    Enlarge
    toEntity button (Ctrl+T)
  5. Select the crate using the Selection Tool.
  6. Click the toEntity button to tie a function to the primitive. This will bring up the Object Properties dialog box.
  7. Select func_breakable from the Class: drop-down menu.
  8. Under Keyvalues, select Name and name your crate something descriptive.
    func_breakable object properties
    Enlarge
    func_breakable object properties
  9. Under Keyvalues, select Strength. The Strength value specifies how much damage the crate can take before breaking. Set the value to 1.
  10. Under Keyvalues, select Material Type. The material type specifies the sounds the crate will make and also what type of gibs it will break into. Select Wood from the drop-down menu.
  11. Under Keyvalues, select Physics Impact Damage Scale. This scales damage energy when the object is hit by a physics object.
    Image:note.png Note: A value of 0 means this feature is disabled. Set to 1.0 for materials as strong as flesh, smaller numbers indicate stronger materials.
  12. Click Apply and close the Object Properties dialog box.


Crate Texture

Once our crate is correctly sized, we can apply a proper texture to it using the same technique we used previously.

  1. Open the Texture Browser and filter for crate.
  2. Select props/woodcrate001a and apply it to your cube. You may have to use the Face Edit Sheet to fit the texture to the cube.
    Image:note.png Note: Ensure that the texture is aligned to Face.
Textured functional crate
Enlarge
Textured functional crate


Back to Creating a Room Return to Your First Map Continue to Adding Entities



This page is also available in: French (français)