Jump to content
  • Advertisement


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

Abdhl Al Hazred

Elevation tool

This topic is 5743 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!