Hello everybody,
I playing since few days with Dark Dynamics and there is one last thing I dont unterstand. I try to have a terrain and make a Heightfield. Then I spawn a Dynmaic box over it. I expect that this box rolls over the terrain but it only falls through. I am useing the expample from Dark Dynamics.
Heightfield
function makeTerrain()
Load Image "../../Media/Terrain/texture.jpg", 1
Load Image "../../Media/Terrain/detail.jpg", 2
//Setup Terrain
Make Object Terrain terrainID
Set Terrain HeightMap terrainID, "../../Media/Terrain/map.jpg"
Set Terrain Scale terrainID, terrainScale, 1.0, terrainScale
Set Terrain Light terrainID, 1.0, -0.25, 0.0, 1.0, 1.0, 0.78, 0.5
Set Terrain Texture terrainID, 1, 2
Build Terrain terrainID
endfunction
function makeHeightField()
x = Get Terrain X Size(terrainID)
z = Get Terrain Z Size(terrainID)
//-- Create a height field desc structure to hold our
//-- height data. This structure must be the correct size
//-- for the terrain, in this case 256x256.
descID = 1
DYN MAKE HEIGHT FIELD DESC descID, x, z, -1000, 0, 0
//-- Retrieve and then set our height data, remembering the terrain is scaled.
for i = 0 to x - 1
for j = 0 to z - 1
height = Get Terrain Ground Height(terrainID, i * terrainScale, j * terrainScale)
DYN HEIGHT FIELD DESC SET DATA descID, i, j, height
next j
next i
//-- Now all our data is set we create a height field, this height field can
//-- be instanced as many times as you like, this is useful if you have repeated
//-- your terrain to save memory.
DYN MAKE HEIGHT FIELD heightFieldID, descID
//-- We no longer need desc.
DYN DELETE HEIGHT FIELD DESC descID
//-- This is where we create our actor instanced from the height field
//-- we have created.
//-- Since the data was collected from a scaled up area we need to scale our
//-- height field to match.
DYN INSTANCE HEIGHT FIELD terrainID, heightFieldID, 5.0, terrainScale, terrainScale
endfunction
Spawn Dynmaic Box
// Spawn Dynamic Object
if mouseclick() = 0 then LMB = 0
if mouseclick() = 1 and LMB = 0
make object cube obj, rnd(5)+1
color object obj, rgb(rnd(255), rnd(255), rnd(255))
set object ambient obj, 0
position object obj, camera position x(0), camera position y(0), camera position z(0)
rotate object obj, camera angle x(0), camera angle y(0), camera angle z(0)
move object obj, 30
rotate object obj, rnd(360), rnd(360), rnd(360)
dyn make box obj, 1
inc obj
LMB = 1
endif
System: Win 8.1 64 / Core i5 (3,9GHz), GeForce 760 GTX 192 - Bit Dx 11 (Driver 335.23) / 8GB Ram