Code archives/3D Graphics - Effects/Terrainedit

This code has been declared by its author to be Public Domain code.

Download source code

Terrainedit by fireshadow41262009
example: u could use this with a for...next statement and width and depth 0 to create a forest of spikes
height has to be 0-1
to make the height seem greater, scale the y axis of the terrain
Function terrainedit(terrain,x,z,width,depth,height)

	end_x = x + width
	end_z = z + depth
	
	For a = x To end_x
	For b = z To end_z
		ModifyTerrain terrain,a,b,height
	Next
	Next
	
End Function

Comments

Matty2009
You might want to do some bounds checking on those for loops, in particular the end_x and end_z variables.


DreamLoader2009
how to do a circle raise?


fireshadow41262009
circle:


The 100s are to make the circle not on the very edge of the terrain.
To increase the radius of the circle, replace the 5s
with whatever you want


_Skully2009
A better way to do circles inside a grid is to use distance... for example, in a rectangle

cx=50
cy=50
radius=30
for x=0 to 100
  for y=0 to 100
     if sqr((cx-x)^2+(cy-y)^2)<=radius then
        ;Inside circle
     else
        ; outside circle
     Endif
  next
next





Code Archives Forum