Hey,
sry im really new here and my english is not the best! (im form germany)
I want to ask, how to make an Collision beatween a terrain and a car.
I use this snippet: http://forum.thegamecreators.com/?m=forum_view&b=6&t=54135&p=0
Its really the best car engine then i ever seen!
But i want to make my own terrain. I want to try one but i cant get it... my car through the terrain.
Heres my gLevels.dba
Rem *** Include File: bin\gLevels.dba ***
Rem Created: 15.05.2005 02:56:47
Rem Included in Project: C:\Documents and Settings\Tamer ÖZTÜRK\Belgelerim\Programlar\Dark Basic Software\Dark Basic Professional\Projects\Drive\Drive.dbpro
prepareLevel1:
mapsize =500 `This defines how big our terrain will be.
segments= 64 `This is the number of segements we want in our matrix.
make matrix 1,mapsize,mapsize,segments,segments `Here is our matrix, which will soon
`be molded by our heightmap.
load image "gfx\levels\map.bmp",1 `This is our heightmap image.
size=256 `Since we know our heightmap is 256 by 256 pixels, we set
`a variable for this.
load image "gfx\levels\texture.bmp",2 `This is our texture for the terrain
prepare matrix texture 1,2,1,1 `This command applies the texture to the matrix.
`This next step is the most important, as we'll begin reading our heightmap data.
cls `Clear the screen, to make sure we can read the data correctly.
paste image 1,0,0 `Paste the image to the screen.
modifier=size/segments `Since our image has more pixels than we have segments, we need
`to make sure we can account for that difference, by getting every
`height after 2 pixels(256/128=2) rather than every pixel.
for x = 0 to segments
for y = 0 to segments
pixelcolor#=rgbr(point(x*modifier,y*modifier)) `This will return the color value.
set matrix height 1,x,y,pixelcolor# `With the color value, we then set the
next x `matrix height according to that color.
next y
update matrix 1 `Finally, we must update our matrix to show the changes that've taken
`place.
```````Creating the water```````
`Many times people make creating water a huge task, and this can result in overkill in
`both looks and system performance. For this tutorial, all we're going to do is make a
`plain. Sounds a little too easy, but by placing it in the terrain, we'll let the terrain
`create the smooth edges of the water for us. Also, by using an object for water
`(versus a matrix), we can apply reflections or even(for more advanced users) shaders.
`Lets keep things simple right now, and just get some decent looking water.
water=5000 `Our variable for our water object
make object plain water,mapsize,mapsize `We make it as big as our map, to ensure all areas
`get covered.
load image "gfx\levels\5.bmp",water `Load our image we'll use to texture our water.
texture object water,water `Texture our object
set reflection shading on water `We give our object reflection properties.
`Be careful, use this command sparingly, as it's
`very system intensive.
set alpha mapping on water,25 `We give our water transparency.
`This way we'll be able to see through our water.
waterheight=15 `This is where we'll position our water on the
`y-axis.
position object water,mapsize/2,waterheight,mapsize/2 `We position our water.
xrotate object water,-90 `Rotate our water.
`We don't want trees under our water, so we'll get rid of them.
`If some trees are still half under the water, you can adjust the values accordingly.
for x = 1 to Plants
if object exist(x) `Check to see if the object exists
if object position y(x)<=waterheight then delete object x `Delete object if it's under
endif `the water.
next x
`As you'll see later in our main loop,(under "[====Water===]"), we'll make it slowly
`move up and down to give it a coastline.
`````Creating the skysphere`````
`A skysphere is an object textured that'll act as the sky. Skysphere's are created
`by using a sphere of a negative size(so the faces are flipped towards you) and then
`texturing it.
sky=5001 `Our variable for the skysphere.
load image "gfx\levels\6.bmp",sky `Load our texture for the skysphere.
make object sphere sky,(-mapsize*2) `Here we create our sphere, and ensure it's big enough
`to cover the map, by multiplying it by the mapsize.
texture object sky,sky `Texture our sky with the sky texture.
position object sky,mapsize/2,0,mapsize/2 `We position our skysphere.
NewtonColBox(5000, 0, 0)
NewtonVehicle("Ford",3.5,0.8,1.3,6.1,4.25,-2.0,2.7,0.98,10.5,0.2,1000.0)
RETURN
Thanks for the Help