Skip to main content
gamedev.net
🔒 Locked

Elevation tool

Started by Abdhl Al Hazred Oct 3, 2002 at 9:56 AM 0 replies 800+ views
Original Post
Abdhl Al Hazred
Abdhl Al Hazred
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!
When the stars are right they will awake...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.