Getting a func_instance on grid?

Jan 8, 2011
397
393
So I've got a very large instance on my map (my entire point B) and it's rotated on a 45 degree angle. Everything seems fine, except that because it's an instance, it's a bit off-grid. This poses a problem, because I can't get a seamless transition between the regular map and the instanced stuff. I might be able to just work around it with a bit of ugly brush overlap, but it would be better if I could just line it up. Ideas?
 

Idolon

they/them
aa
Feb 7, 2008
2,107
6,116
You're trying to pair up 1hu-based measurements to ~1.41hu-based (diagonal of a 1hu square) measurements. Since the square root of 2 is irrational, your grids will literally never line up. There's probably a way to cut 22.5 degree angles into two same-width hallways and line them up, but I can't tackle the math required. I'd look into the technique described in the koth_roundhouse thread and try and devise your own methods, but you might be best off just remaking point B as on the grid, diagonally.
 
Jan 8, 2011
397
393
The scale is the same, I think it's the rotation that's the issue. The whole func_instance entity is on-grid, it's just that the brushes within it aren't anymore (again, probably because of the 45 degree thing). I've just done the overlap for now; it's not very noticeable, and only exists for less than one HU.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,670
Idolon is right, you would need to shape and cut the instance's brushes in such a way they'll match up to the rest of it. The same as if you were to make it not instanced.
 

Empyre

L6: Sharp Member
Feb 8, 2011
309
187
Would it work if you instanced the bulding but not the ground? You would probably have to have a small flat area around the building. As long as the instance is level, I think the alignment should not be an issue.
 

Fish 2.0

L6: Sharp Member
Nov 22, 2012
324
262
Yeah, Pythagoras says that a hypotenuse on a right angled triangle (45o as you said) has to be the biggest length in the triangle.

That means that if you have a line that is 1 unit high then when you rotate it to be the hypotenuse it /has/ to be bigger or else it can't actually be on an angle to form a triangle.

a^2 = b^2+c^2

so

if your A length is 1 and your B length is one then your C length (hyp) needs to be 1.41421356237.

Solution - scale the section up by 1.41421356237. However you will note that that size is rather large so you could scale your section down till it fits on the grid, rotate it then scale it back up and it should be about the same size and on the grid. After testing it I found that scaling by 0.75, rotating then up scaling by 1.41421356237 just unscaled it a bit.

This might not work but it worked when I tested it.
 
Last edited:

Spacek531

L4: Comfortable Member
Jan 28, 2012
165
94
I don't know if it's possible in this situation

but

you can rotate by arctan(3/4) or arctan(4/3) then the hypotenuse is 5, which is an integer hu
 
Sep 7, 2012
638
500
These people seem to have all the answers.....

When I had this problem before I was fortunate enough that only one side of the instance had to connect into another building. My solution was to move my instance into one quadrant of the map, lining the corner up with the origin. This allowed the sides near the origin to mesh perfectly with anything in the real map, which will work for you as long as you don't need to connect both sides.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,696
2,580
You never said what sort of structure we're talking about here. Since it's only on a 45 degree angle, it might have been a better idea to simply construct it on-grid already rotated, like in Double Cross and Foundry. Instancing is really better for stuff that's impossible to build on-grid, like the shed by BLU's spawn in Mountain Lab/Mann Manor that's on a 30 degree angle.
 

Empyre

L6: Sharp Member
Feb 8, 2011
309
187
Nobody commented on my idea. Maybe I didn't explain it clearly.
I think you can bypass the whole alignment issue by building the ground in the main map with flat areas slightly larger than the building(s) in the instance. Then you plop the instanced building(s) in place, and things only have to be on-grid on the vertical axis, and it won't matter that things are off-grid in the horizontal plane.

EDIT a day later: Re-reading this, it sounds like I am rather arrogant. This was not intended. Please interpret what I said as awkward wording, not a bad attitude.
 
Last edited: