Terrain Collision Problems

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Terrain Collision Problems

Post by Atraides »

Hi all

I'm currently working on a project where we have a tank driving across a terrain scene node. We are using IrrNewt physics wrapper for Newton.
However we are experiencing problems with our terrain scene node where the tank will drive straight through the rendered terrain. We have created the Height map using the program EarthSculpture.

It appear to be that the TriangleSelector generated for the terrain is not the same as the displayed TriangleSelector.


I'm wondering if anyone else has had this problem and whether they have been able to solve it.


Cheers
Courtney
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You have to be careful with scaling the terrain. IIRC you have to scale first, then create the triangle selector.
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Post by Atraides »

When i load the terrain height map i automatically scale it in the constructor then irrNewt gets the physics data from the created node.

Code: Select all


world_node = smgr->addTerrainSceneNode("media/level1.png",0,-1,vector3df(0,0,0),vector3df(0,0,0),vector3df(10, 1.0f, 10),SColor(255,255,255,255),5,ETPS_17,0,false);

	world_node->setMaterialFlag(video::EMF_LIGHTING, false);
	world_node->setMaterialTexture(0, driver->getTexture("media/brownsand.png"));
	world_node->setMaterialTexture(2, driver->getTexture("media/orangesand.png"));
	world_node->setMaterialTexture(1, driver->getTexture("media/longGrass.png"));

...
...
...

p_world=irr::newton::createPhysicsWorld(device);

	//level body
	irr::newton::SBodyFromNode levelData;
	levelData.Node = world_node;
	level_body = p_world->createBody(levelData);

So im not sure that its the scaling thats an issue ... unless scaling in the constructor doesn't work.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

This is really more of an irrNewt issue then an irrlicht issue. Try to disable scaling and see if the problem is gone. Other things to try is to draw the newton debug data and see if it matches the irrlicht version (I highly doubt it does) and to make sure the bounding box and physics position of the tank is correct and matches the scenenode version.

There are many factors to consider, so I suggest you get started :D
Atraides
Posts: 18
Joined: Wed Jun 06, 2007 1:09 am
Location: Australia

Post by Atraides »

Yeah, i checked out the node data that is stored within thee newton body and found that the relative Scale values were identical. So i'm not sure whats wrong..
Post Reply