Crashing when using a collision for camera and newton

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Guest

Crashing when using a collision for camera and newton

Post by Guest »

I thought I had this thing working, and for some reason now I am getting a random crash when I put in collosion for the camera. I pretty much have stripped the code down to bare using the tutorial for the Newton intergration and added these lines, (I ripped the camera code out where it was in the Init fuction and moved it into Prepare):

Code: Select all

void CGame::Prepare()
{
	// add skybox
	smgr->addSkyBoxSceneNode(driver->getTexture("data/irrlicht2_up.bmp"),driver->getTexture("data/irrlicht2_dn.bmp"),driver->getTexture("data/irrlicht2_lf.bmp"),driver->getTexture("data/irrlicht2_rt.bmp"),driver->getTexture("data/irrlicht2_ft.bmp"),driver->getTexture("data/irrlicht2_bk.bmp"));

	// load map
	g_map = smgr->getMesh("data/castle.x");
	g_mapnode = smgr->addOctTreeSceneNode(g_map->getMesh(0));

	// create map triangle selector
	mapSelector = smgr->createOctTreeTriangleSelector(mesh->getMesh(0),
			g_mapnode, 128);


	metaSelector = smgr->createMetaTriangleSelector();
	metaSelector->addTriangleSelector(mapSelector);

	scene::ISceneNodeAnimatorCollisionResponse* collider = 
				smgr->createCollisionResponseAnimator(
				metaSelector, camera, core::vector3df(30,50,30), 
				core::vector3df(0, g_mapnode ? -100.0f : 0.0f,0), 100.0f,
					core::vector3df(0,40,0), 0.0005f);
		    
			camera->addAnimator(collider);
			collider->drop();
Is newton and IRRICHT code fighting it out here? Any suggestions on how to use Newton to add a camera collider?
Mercior
Posts: 100
Joined: Tue Feb 24, 2004 1:53 am
Location: UK
Contact:

Post by Mercior »

Not sure what is specifically wrong with that, but I have newton collision & irrlicht collisions working together just fine. Try creating the response animator from the map selector, not the meta one..
Guest

Post by Guest »

hmm..., well found the cause of the crash. I was creating two cameras without realizing it. But now the camera, or player just falls through the mesh. I tried your suggestion, and it doesnt collide at all but doesnt fall, either. Any suggestions on how to set it up so the camera, or player can walk on the mesh that is landscape like in the collision example using your code that used the newton SDK?
Post Reply