Character falls through terrain

Dutchie

24-06-2007 13:04:59

i made a character and a terrain, but the problem is that the character falls through the terrain.

here is the code i use to create the character and terrain:


Player = TFOHScene->createCharacter("PlayerChar", Vector3(25, 75, 25), "type: box, dimensions: 1 2 1");
Player->attachMesh("Cube.1m.mesh");
Player->getNode()->scale(1,2,1);

sceneMgr->setWorldGeometry("terrain.cfg");
TFOHScene->createActor("terrain", new TerrainShape("terrain.png", 3000, 100, 513), Vector3::ZERO, "static: yes");


i use the terrain.cfg from the ogre examples, with a few modifications(only shown the modifications):

# Heightmap-source specific settings
Heightmap.image=terrain.png

# If you use RAW, fill in the below too
# RAW-specific setting - size (horizontal/vertical)
#Heightmap.raw.size=513
# RAW-specific setting - bytes per pixel (1 = 8bit, 2=16bit)
#Heightmap.raw.bpp=2

# How large is a page of tiles (in vertices)? Must be (2^n)+1
PageSize=513

# How large is each tile? Must be (2^n)+1 and be smaller than PageSize
TileSize=65

# The maximum error allowed when determining which LOD to use
MaxPixelError=3

# The size of a terrain page, in world units
PageWorldX=3000
PageWorldZ=3000
# Maximum height of the terrain
MaxHeight=100


i use NxOgre 0.9-27 with ogre 1.4.2 compiled under Visual C++ Express 2005 SP1


how can i solve this? i think i have put something wrong with creating the terrain, but don't know what.

betajaen

24-06-2007 13:24:16

I believe it's related to a bug. Which is described in detail here. You'll have to modify NxOgre itself to fix it. Just search for "mMaxHeight / (32768.0f * 2)" and you'll find it. ;)

You could also turn on the debug renderer and see if the Ogre terrain matches up with the NxOgre terrain. But after that silly bug is squashed, I'm sure it'll work fine.

Dutchie

24-06-2007 14:11:02

you was sure that it will work fine... but it doesn't
withouth the *2, the terrain is too low. and with the *2 the terrain is even LOWER.(into the debugger i saw this).

are you sure that i have configured it good?

Dutchie

24-06-2007 14:28:12

i have noticed another thing... in the debug renderer the terrain is almost flat, much much much flatter than in the game.

Dutchie

26-06-2007 20:01:10

tried some stuff in the terrain files. still don't have a solution, anyone an idea?