multiple CollisionResponseAnimators for one Scenenode?

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
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

multiple CollisionResponseAnimators for one Scenenode?

Post by instinct »

Hey everybody!

I've built my own map in GtkRadiant. I've placed some walls and obstacles which i want to be solid, in other words: they cant be broken. But i also want some other scenenodes (some kind of walls i add by simply coding them in the map) that cán be broken. Untill now everything went fine. But when i also want to apply collision to the breakable scenenodes my character is acting weird. I've put some very simple 'jumping' code (when space is pressed, add 3 to the y.axis) which works good when i only aplly collision to my .bsp file, but when i apply collision to both my .bsp file and the other scenenode the jumping's become very weird (i cant jump as high as i could). However, when im close to the cube, it jumps correctly again. I've added my code and have highlighted the 2 CollisionResponseAnimators so you dont have to search a lot ;)

I really hope some1 can help. By the way, is it possible to add 2 CollisionResponseAnimators to my sydney scenenode?

Code: Select all


...
some code
...

	scene::ISceneNode* n = smgr->addCubeSceneNode();
	if (n)
	{
		n->setScale(vector3df(1,1,1));
		n->setMaterialTexture(0, driver->getTexture("media/t351sml.jpg"));
		n->setMaterialFlag(video::EMF_LIGHTING, false);
		n->setPosition(core::vector3df(-200, -59, 0));
		ITriangleSelector* nodeselector = smgr->createTriangleSelectorFromBoundingBox(n);
		n->setTriangleSelector(nodeselector);
		printf("Aantal triangles in node: %d \n", nodeselector->getTriangleCount());
		ISceneNodeAnimator* nodeanim = smgr->createCollisionResponseAnimator(nodeselector, sydney, vector3df(30, 30, 30), vector3df(0, -3, 0), vector3df(0, 0, 0));
		nodeselector->drop();
		sydney->addAnimator(nodeanim);
		nodeanim->drop();
	}

...
some other code
...
	
	ITriangleSelector* selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3level);
	q3level->setTriangleSelector(selector);
	printf("Aantal triangles in de hele wereld: %d \n", selector->getTriangleCount());
	
	ISceneNodeAnimator* animator = smgr->createCollisionResponseAnimator(selector, sydney, vector3df(20, 25, 20), vector3df(0, -3, 0), vector3df(0, 0, 0));
	selector->drop();
	sydney->addAnimator(animator);
	animator->drop();	
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

u might be better off just using a single animator feeding it with a metaTriangleSelector and just ad to that one the 2 triangle selectors u already have ?

I think that might solve your problems

Best regards
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

i'll try that! thanks for your reply ;)
Post Reply