Placing trees onto terrain

Blitz3D Forums/Blitz3D Programming/Placing trees onto terrain

Oiduts Studios(Posted 2009) [#1]
Ok, i used to have a way to randomly place trees onto a terrain but i cant find it, this is all i have, please help

For a = 1 To 1000

palm=CopyEntity( palm ) : ShowEntity palm
bx = Rnd (5000)
bz = Rnd (5000)
ScaleEntity palm1,15,15,15
PositionEntity palm1, bx,???????, bz
EntityType palm1,SCENE

Next


_PJ_(Posted 2009) [#2]
TerrainY()


Oiduts Studios(Posted 2009) [#3]
what do i put in the command though?
TerrainY# (terrain,x#,y#,z# )
how would i set this up?


Drak(Posted 2009) [#4]
Use what you have already.

scaleentity palm1, 15,15,15      ;you don't need to specify these each Loop
EntityType palm1,SCENE           ;copyentity() copies entity commands as well as the mesh

For a = 1 To 1000

palm=CopyEntity(palm) 
bx# = Rnd (5000)
by# = 0           ;this number actually doesn't matter
bz# = Rnd (5000)
terrain_height# = terrainY(YOUR_TERRAIN'S_NAME, bx,by,bz)
PositionEntity palm1, bx,terrain_height, bz 


Next 




Oiduts Studios(Posted 2009) [#5]
YES! Thanks a lot Drak it works perfectly. i have been trying to get this to work for a long time.