collision does not work with complicated mesh. Please help!

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
pat-rizio
Posts: 20
Joined: Thu Jan 05, 2006 10:59 am

collision does not work with complicated mesh. Please help!

Post by pat-rizio »

Hi,
I'm tring to do collision response in a room. It works perfectly importing some cube's models I made, but importing this palm model of a human hand it has a strange behaviour: when I try to collide with it I can't go trought it (and this it's good) but I can't go away from the node!
Just to understand the behaviour, it seems like there's an attraction which don't let me go away from the palm I've imported if I collide with it.

I create the palm node as follow:

Code: Select all

	scene::ISceneNode* palm= 0;
	
	palm= smgr->addOctTreeSceneNode( smgr->getMesh(mesh_file) );
	
	if (palm)
	{
		palm->setPosition(position);
		palm->setMaterialTexture( 0, driver->getTexture(texture_file) );


		obj_selector = smgr->createOctTreeTriangleSelector( smgr->getMesh(mesh_file)->getMesh(0) , palm);
		palm->setTriangleSelector(obj_selector);
		obj_selector->drop();

		world_selector->addTriangleSelector(obj_selector);
where "mesh_file" is a string link to my model to which I made a link on top of this post, "position" is the position of the node, "obj_selector" is a ITriangleSelector* and "world_selector" is a IMetaTriangleSelector* to which all object's ITriangleSelecotor* of my scene are attached.

Then I make collision response on tha camera:

Code: Select all

	scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 30.0f, 20.0f, -1, 0, 0, false);
	camera->setPosition(core::vector3df(0,40,-20));
	scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(world_selector, camera, core::vector3df(2,2,2),	
																																			 core::vector3df(0,-0,0), core::vector3df(0,0,0));
My hand's palm model has got 314 vertices and 624 faces.
Maybe I created a corrupted model (if so, could anyone explain me what I did wrong on it?) , or maybe Irrlicht has some problem to create an ITriangleSelector* from a complicated mesh?
Post Reply