Brush Alignment to Grid

  • If you're asking a question make sure to set the thread type to be a question!

Timberjaw

L2: Junior Member
Nov 6, 2009
71
19
Hello,

I'm having a bit of trouble getting a particular brush to stay aligned to the grid while moving it. The brush is 208x160 units. It was made by taking an arch (180 degrees, 4 wall thickness) and clipping (not carving) all but 160 of the original width. The brush seems properly formed, and the vertices at each end of the arc are aligned to the grid. The selection rectangle when I click on the brush is also aligned to the grid.

As soon as I start moving the brush, however, it becomes misaligned, shifting just over 2 units up or down on the Y axis. The only way to realign it that I've found is to resize it on the Y axis, snapping it back to the grid. Moving it again misaligns it again.

It's not a huge problem because of the workaround I've found, but it's pretty annoying. I was wondering if there's a known cause for this; something I can avoid or some way to fix it. I've run into the same issue a few times before, including once or twice with regular rectangular brushes.

Am I just being stupid and missing something totally obvious? :O
 

megawac

L4: Comfortable Member
Oct 2, 2009
180
29
I can't think of whats wrong based on your description so I'll offer you some simple advice for moving odd shapes. Make a skip brush that completely encompasses the object you want to move (probably slightly bigger, keep it on grid). Than simply group the skip and your complex object and move it with the skip brush.
 

Timberjaw

L2: Junior Member
Nov 6, 2009
71
19
I can't think of whats wrong based on your description so I'll offer you some simple advice for moving odd shapes. Make a skip brush that completely encompasses the object you want to move (probably slightly bigger, keep it on grid). Than simply group the skip and your complex object and move it with the skip brush.
Thanks. Right after I posted this I happened to move the bad brush while selected with another (properly aligned) brush and noticed this phenomenon. Your skip brush workaround is more convenient though.

Curiously, the misalignment behavior has now disappeared, without any modifications to the brush in the meantime (that I recall, anyway).

Update: able to reproduce predictably.

Steps to reproduce:
  1. Create an arch (mine have been 180 degrees)
  2. Using the Clipping Tool, cut off more than 90 degrees of the arch
  3. Resize the resulting arc segment to snap it to the grid (e.g. from 54.4 on the x axis to 54, which will snap at grid size 2)
  4. Move segment...now it's misaligned!

Note that the alignment oddity only occurs if one of the segment's dimensions is not grid-aligned after Clipping (e.g. 128.2x64).

Vertex editing to bring the brush back on grid seems to nip the problem in the bud, but only if you do it before resizing the brush.

The amount that the brush will become misaligned is proportional to the amount you resize it by to bring it back on the grid. Hammer is miscalculating the new origin, perhaps?

I haven't found a way to fix the brush after resizing it (without vertex editing first). Tried: vertex editing, copying to new VMF, saving VMF and closing/reopening Hammer, grouping with other object and moving (avoids the misalignment issue but doesn't repair the brush).
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Hint: To keep an oddly-shaped brush aligned to the grid, grab it by one of the corners that's already snapped to the grid when you move it. Sometimes if you grab it by the middle or something, it won't stay aligned correctly.
 

Timberjaw

L2: Junior Member
Nov 6, 2009
71
19
Hint: To keep an oddly-shaped brush aligned to the grid, grab it by one of the corners that's already snapped to the grid when you move it. Sometimes if you grab it by the middle or something, it won't stay aligned correctly.
What do you mean 'grab it by one of the corners'? That resizes it.
 

Timberjaw

L2: Junior Member
Nov 6, 2009
71
19
Don't know if anyone's been following this, but in case someone comes along a year from now and has the same problem, here are my findings:

  • Can reproduce issue without use of the clipping tool
    1. Create arch (I used: 48x48x48, wall thickness 4, sides 8)
    2. Resize arch (tube, really) vertically (lengthening tube)
    3. Move tube. Now it's misaligned.
  • FIX: Ungroup :)ungroup: Ctrl+U) and Regroup :)group: Ctrl+G) the arch. Presto, arch now moves correctly with the grid.
  • Note: If the arch is off-grid, you need to bring it back on-grid before ungrouping and regrouping.
  • Note 2: Further resizing can (but won't always) cause the group to become misaligned again. Seems to be dependent on the axis you're resizing along.
  • Note 3: This issue can be reproduced with any brush group, not just arches. A simple group of two block primitives exhibits the same misalignment issue if you resize it along the right (wrong? :p) axis.
  • Note 4: Resizing the group to snap it back on-grid will not prevent misalignment, but resizing the group back to its original size will.

Conclusions:
  1. Group alignment is buggy in Hammer.
  2. Ungroup and regroup to fix (make sure group is grid-aligned first!)
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
What do you mean 'grab it by one of the corners'? That resizes it.

No, grabbing one of the (larger) white boxes around the corners does that. Grabbing the actual corner, with the tiny white box, should still move it.
 

Timberjaw

L2: Junior Member
Nov 6, 2009
71
19
No, grabbing one of the (larger) white boxes around the corners does that. Grabbing the actual corner, with the tiny white box, should still move it.
Ah, I see it now. Unfortunately, the tiny white boxes don't show up in the corners for irregular brushes like an arch. They're not actually part of the selection tool. They show up on each brush vertex, so they happen to be in the corners for rectangular brushes.

You are right that there is a difference in how Hammer moves selections based on where you click, though. What I'm finding is that if I click one pixel outside the selection box on either the top or the left, the selection will move with the grid. The right side and the bottom don't work because I can't click the selection box unless the cursor is about one pixel inside the drawn box. Curiouser and curiouser.

Conclusion: clicking just outside the selection on the top or left will also avoid the misalignment problem, but ungrouping and regrouping is probably easier as it requires no precision mouse movement.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Ah, I see it now. Unfortunately, the tiny white boxes don't show up in the corners for irregular brushes like an arch. They're not actually part of the selection tool. They show up on each brush vertex, so they happen to be in the corners for rectangular brushes.

Right. But what I was saying is that if one of the vertexes was already on a grid crosshair, you can grab it by that vertex and dragging it should keep it snapped.

Anyway it looks like you've got things under control, but for the record there's also the "Move" option under Tools > Transform if you're ever in a spot where nothing else works.