This topic is now archived and is closed to further replies.

Abdhl Al Hazred

Elevation tool

Recommended Posts

How do you think the elevation tool works in Heroes of Might & Magic 4? It´s a nice tool to create realistic hills that does not look like pointy mountains. You can lower or raise the ground and have controll over the effects distance. How to implement code to create a function that change the height of the ground (that is a isometric vertex grid)? My code to attemp to create somthink like this looks like this:

for( int y=0; y<m_pkTerrain->m_usNumRows+1; y++)
							for( int x=0; x<m_pkTerrain->m_usNumCols+1; x++)
								float hill_x_center = m_kSqrClickPos.x;
								float hill_y_center = m_kSqrClickPos.y;

								float length_x = fabs(x - hill_x_center) / (m_pkTerrain->m_usNumCols+1);
								float length_y = fabs(y - hill_y_center) / (m_pkTerrain->m_usNumRows+1);

								if(length_x < 0.15f && length_y < 0.15f)
									float fHeight = -1.75f + 10.0f * sqrt(length_x*length_x + length_y*length_y);

									if(bRaiseGround == false)
										fHeight = -fHeight;

									m_pkTerrain->AddHeight(fHeight, x, y, Bottom);
But the hill doesn´t look good. Please help!

Share this post

Link to post
Share on other sites