Game Development Community

Is there a Get Height for Terrain Editor ?

by Cai Yundong · in Torque 3D Professional · 08/10/2010 (3:01 am) · 5 replies

Hi, just wondering, is there a get height feature for terrain editor hidden somewhere ? currently there is a set height feature, but the height has to be set manually, which can get pretty troublesome if you're trying to set multiple different heights. What i am looking for would be a function to click on a particular area on the map which will then set the height for "set height" and i can start painting.

Also The "flatten" does not seem to flatten per se,but actually seems to raise a slightly higher flat surface. Or am i going about stuff wrongly...

#1
08/10/2010 (1:06 pm)
I'm with you 110% for some sort of set-height tool, would be one of those small UI additions that would speed up workflow enormously.

Flatten currently flattens the brush area using an average of the highest and lowest point inside the brush area. Most useful with a single click using a larger brush area; helps in preparing a place for objects that have flat bottoms/floors.
#2
08/10/2010 (1:37 pm)
Taking a hint from Photoshop, a modifier could be used to sample the height and set the Set Height tools value, this would allow for a very fast work flow.

This prob would be very easy to set up, but I don't have the source in front of me right now.
#3
08/10/2010 (5:45 pm)
Hi Guys,

Had a quick look and I couldn't see any way to set the TerrainEditors "mSetHeightVal" so here would be a hacky way to do it...

in terrainEditor.cpp right at the bottom add this console method:

ConsoleMethod( TerrainEditor, setFlattenHeight, void, 3, 3, "( Float Height ) Set's the height.")
{
	object->mSetHeightVal = dAtof( argv[ 2 ] );
}

then in game, when you enter the terrain editor and select the "Set height" tool (or press 7) you will see in the bottom left an "average" height wherever you are hovered over, take that as a rough guide as to what you need to put when you call

ETerrainEditor.setFlattenHeight( F32 );

Then place your building, and you can smooth round any edges.

The terrain editor smooth action will take the average height as you smooth, hence why it doesn't "seem" to smooth, if you where to set the max brush size and click a lot of times in the exact same spot then it should smooth just that area perfectly...

if it didn't work the way it did then you would never get a smooth area as it would always be "blocky"...

Hope that helps!

Edit:

Also Brian,

I had the same idea about placing a building and have it "automatically" set the height for you, I implemented it in my deformer but you would have to have a variable to hold the object you want to set the height against, with the deformer, as it was attached to an object it did a ray cast at the deform position to get the height, which is what you are after...

you would also add a "force set height" for that, because if the terrain was lower the deform event would not fire, I did add a method where it would get the current deformers object height, and update the terrain to match it...

Had issues with the Deformer RE networking and just testing the code from B1 on B2 now and its brokened in a couple of places, but if you fancy having a look how I did it then I will send you the files...
#4
08/12/2010 (4:03 am)
Thanx Tim and Leon, wonderful workaround ! :D

Thanx to all for the explanation of the flatten tool.

On aside note, does anyone have the GMK ? As it seems to have a "set to/on ground" feature based on the screen shots.
#5
09/08/2010 (3:19 am)
The next release (1.1b3) has the SetHeight value in the toolbar, and ALT+Left click (when SetHeight tool is active) will sample the terrain at the cursor position to set the height.