3D terrain thingi

Blitz3D Forums/Blitz3D Programming/3D terrain thingi

Paul "Taiphoz"(Posted 2003) [#1]
Lo all.

This is a shot of a project im working on. The problem im having is with the landscape.

Its a 3ds model I loaded up, and I need to know what height a part of it is, based on the location of an object like a tree a rock a fence or a sheep.. so that I can make sure the object is on the landscape and not sunk into it.

If you know what I mean.

Any help is welcome. thanks..



Binary_Moon(Posted 2003) [#2]
Simply take a point you know is above the ground (y=1000 ?) and then do a linepick straight down. Then use the pickedY value to get the exact height for positioning. I would recommend placing your object slightly lower (if its a tree or a rock) so that the object looks like it is placed firmly.


Paul "Taiphoz"(Posted 2003) [#3]
would that method be fast enough for something that moves ? ie the sheep running all over the place ?


poopla(Posted 2003) [#4]
Yes, it's plenty fast. Every loop do this.

1. Get current sheeps position.
2. Pick from 1 unit above the sheep 2 units below it.
3. Assuming the sheeping isnt moving at warp speed this will return the height of the terrain directly below the sheep.
4. Position the sheep.


AbbaRue(Posted 2003) [#5]
I am working on a large terrain myself and I place all
objects on the terrain with the following format:

PositionEntity Ent01,xx,TerrainY(Terrain,xx,0,zz)+80,zz

The +80 can be adjusted to get just the right hight.

For tt = 1 To trees
Treeb(tt) = CopyEntity(Ent01) ;another tree
RotateEntity(Treeb(tt),-90,Rnd(0,320),0)
xx=Rnd(10,rd)
zz=Rnd(10,rd)
ScaleEntity Treeb(tt),4,4,4
PositionEntity Treeb(tt),xx,TerrainY(Terrain,xx,0,zz)+80,zz
Next

use this to place many copied trees on the terrain.


Bot Builder(Posted 2003) [#6]
True, AbbaRue, TerrainY would work on a blitz terrain, but he's using a custom 3ds object