Page 1 of 1

[ask] how do we do colllision with terrain?

Posted: Sat Oct 25, 2008 6:13 am
by Daggio
OK, I used irredit to generate my world terrain
I don't have much heightmaps so I used the default one that comes with irredit, it generates the terrain nicely and I was able to load it with irrlicht

the problem is when I want to do collision with it, I've tried code from example 7,but it didn't work :(

I've changed the code in example 7 a bit to fit my need, for example I don't use the addZipFileArchieve() but I used loadScene()
after that I don't know what parameter should be used in the smgr->getMesh() (the code in example 7 used it though) but since there's no mesh file in my .irr file I used the heightmap as the parameter
as expected, it generates an error saying that the file format is not supported

so how do you do collision detection with terrain? I've searched this forum but what I got is the code to get the mesh file in your .irr file (which doesn't work for me because there's no mesh file, just a terrain generated from heightmap)

Re: [ask] how do we do colllision with terrain?

Posted: Sat Oct 25, 2008 9:22 am
by rogerborg
Daggio wrote:I don't know what parameter should be used in the smgr->getMesh() (the code in example 7 used it though) but since there's no mesh file in my .irr file
When your .irr scene is loaded, Irrlicht creates scene nodes and adds them to your Irrlicht scene. ISceneManager provides methods to retrieve one, some or all scene nodes.

For your purposes, the simplest way is probably ISceneManager::getSceneNodeFromName() (I'm assuming that you know the name of the terrain, from IrrEdit).