Hammer Viewports
Introduction
Before you can begin creating and placing solids and entities, you need to familiarize yourself with the Hammer interface. By default, your working area is divided into four sections, called views, or viewports. The first (upper left) window viewport is the 3D View, and the rest are the 2D views.
The active viewport
Certain operations, such as keyboard shortcuts, rely on which of the 2D or 3D views is the active viewport. The active viewport is set by placing the mouse cursor over the desired viewport. Pressing a keyboard shortcut will then use that viewport as a reference.
The 3D view
The 3D window is a dynamic 3D space where you can view your level from any angle. This is critical for checking textures and texture alignment, spotting leaks and just getting a sense of what your finished level will look like.
There are different rendering modes the 3D View can be switched between. See the View Menu for more information.
Using cameras
To take advantage of the 3D view, you need to be able to place cameras. Cameras determine your vantage point in the 3D view. Hammer provides you with precise control over the camera movements in your map.
A camera in Hammer (as displayed in the 2D views) consists of three parts: the eye, the target, and the viewing angle, which is represented by a line extending out from the eye. The length of the line that represents the viewing angle is not important, though it can help you aim the camera exactly at an object.
You can place multiple cameras in a map, you can cycle through them using the PageUp
and PageDown
keys. Only one camera is needed per map, but placing one in each larger part of the map may be helpful.
For everyday purpose, just use the Mouselook/NoClip style movement method described below.
Camera placement
Creating cameras in Hammer is extremely simple. First, switch to the Camera Tool by pressing ⇧ Shift+C
, then hold ⇧ Shift
and with the left mouse button, click-drag a line in one of the 2D views. This will create a thin red line with a large dot at one end. The dot is the camera's position, and this is where the 3D camera view will originate. The red line is the camera's viewing angle. The end of the red line is the camera's target. You can adjust either end of the line by dragging it with the left mouse button to change the view. Follow the above steps to create as many cameras in your level as you need. While in Camera mode, you can adjust the camera position by moving the eye or viewing angle in any of the 2d windows.
See the Camera Tool for more information on how to create and adjust 3D cameras.
Mouselook/NoClip style movement
The "mouselook" movement style is the easiest way of moving around in the 3D view. It is designed to be similar to the in-game "NoClip" mode. Using it is very simple:
- Select the Camera tool, the red camera.
- Click and hold in the 3D viewport.
- Move the mouse like in-game, and use
W
,A
,S
, andD
keys to move. - If your mouse is unavailable for looking (i.e. selecting textures), you may use the arrow keys for looking.
The mouselook can be enabled or disabled by pressing (lowercase) Z
while the 3D view is the active viewport.
Moving your mouse around will change the camera direction. Pressing the W
and S
keys control forward and backward movement, and the A
and D
keys control side-to-side (left and right strafing) movement.
You can disable this movement style by deselecting the "Use Mouselook" setting in the 3D Views options dialog.
Rearranging Viewports
The four viewports can display any of the four views: 2D Top (X/Y), 2D Front (Y/Z), 2D Side (X/Z), or 3D camera. You can change which view is displayed by activating the viewport then selecting View
from the top menu then selecting 2D X/Y, 2D Y/Z, 2D X/Z, or one of the 3D selections. For example the following is a common Computer Aided Design (CAD) configuration where each adjacent view is a rotation about one of the axes.
Once you have the viewports arranged the way you want Hammer should remember it.
Keyboard shortcuts
3D viewport shortcuts
There are a number of keyboard shortcuts that you can use to quickly maneuver through the 3D view without switching to the Camera tool:
- Holding down Spacebar+ left mouse button allows you to rotate your angle of view in any direction, while the viewing point remains stationary.
- Holding down Spacebar+ right mouse button will allow you to move left, right, up, and down while keeping the viewing angle constant.
- Holding down Spacebar+ left mouse button+ right mouse button and moving the mouse causes the view to strafe forward, backward, right, and left.
- Holding down ⇧ Shift+Spacebar+ right mouse button allows you to move forward and backward, as well as from side to side. Note that this is the same result as the previous method. Use whichever you are more comfortable with.
- scroll mouse wheel moves the camera forward and backwards.
- Ctrl+⇧ Shift+E moves the camera to look at the center of the currently selected object(s).
2D viewport shortcuts
- Hold down the Spacebar+ left mouse button to pan the view left, right, up, and down, without using scrollbars or arrow keys. Tip:The scrollbars can be disabled entirely (for more working space) in the 2D Options dialog.
- Zoom
- Press D to zoom in the active 2D view, and the C key to zoom out and synchronize all 2D views together.
- + & - on the numeric keypad zooms all 2D views in and out together.
- If your mouse allows it:
- scroll mouse wheel zooms in and out in the active view.
- Ctrl+ scroll mouse wheel zooms in and out all 2D views simultaneously.
- Ctrl+E centers the 2D views on the currently selected object(s).
General viewport shortcuts
- ⇧ Shift+Z toggles between full screen on the current view, and the default 4 views.
- Ctrl+A resizes all 4 views evenly.