Hey, I just started using UberTerrain with DarkPHYSICS, and it works excellently with the PHY MAKE RIGID BODY STATIC TERRAIN command.
However, this also led me to discover a really bad bug (not related to DarkPhysics). It seems from this code that whenever the MAKE OBJECT SPHERE command or any other make object command is used, the camera's position and rotation are reset to 0. I know it isn't just the FreeObject function, because I tried it with several different random constants as object numbers and still got the same results.
Of course this can be worked around by simply repositioning the camera after you make an object, but that's rather annoying. Thought you should know.
Code I'm using:
sync on : sync rate 60
`phy start
`phy set gravity 0.0,-80,0.0
global FreeObjectTheory
load image "Heightmap.bmp",1
load image "texture.jpg",2
load image "detail.tga",3
terrain=UT MakeTerrain()
UT SetTerrainHeightmap terrain,1
UT SetTerrainTexture terrain,2
UT SetTerrainDetail terrain,3
`Set how many LOD levels there are
UT SetTerrainLOD terrain,3
UT SetTerrainScale terrain,12
UT SetTerrainYScale terrain,2
`Set the split (the terrain will be 8x8 so it will generate 64 sectors)
UT SetTerrainSplit terrain,8
`Set the Tiling of the detailmap
UT SetTerrainDetailTile terrain,2
`Set The LOD Distances (as were only using 4 LOD levels, we only need to fill in the first 3)
UT SetTerrainLODDistances terrain,1000,3000,5500,0,0,0
UT SetAdvancedPhysics terrain,1
UT BuildTerrain terrain
repeat
object=FreeObject()
phyobject=FreeObject()
progress=UT ContinueBuild(object,phyobject,0)
`phy make rigid body static terrain phyobject
until progress=-1
fog on
fog distance 15000
set camera range 1,15000
fog color 128,170,255
color backdrop rgb(128,170,255)
position camera 100,300,100
do
position mouse screen width()/2,screen height()/2
camx#=camera position x()
camy#=camera position y()
camz#=camera position z()
acamx#=camera angle x()
acamy#=camera angle x()
acamz#=camera angle x()
if mouseclick()=1 and clicked=0
clicked=1
temp=FreeObject()
make object sphere temp,20
`position camera camx#,camy#,camz#
position object temp,camx#,camy#,camz#
`phy make rigid body dynamic sphere temp
endif
if mouseclick()=0 then clicked=0
if upkey() then move camera 5
if downkey() then move camera -5
rotate camera camera angle x()+mousemovey()/6.0,camera angle y()+mousemovex()/6.0,0
`phy update
UT Update 0
sync
loop
function FreeObject()
objects=FreeObjectTheory
repeat
inc objects
until object exist(objects)=0
inc FreeObjectTheory
endfunction objects