.irr question

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
happyer
Posts: 17
Joined: Wed Aug 15, 2007 2:07 pm

.irr question

Post by happyer »

If I want to do a collision detection on the .irr file, is it possible? Since I cannot use the getMesh function on the .irr file. Then I can't do the createOctTreeTriangleSelector and createCollisionResponseAnimator. If can, how can I do it?
Thanks.
koller202
Posts: 143
Joined: Tue May 08, 2007 4:53 am
Location: Thailand

Post by koller202 »

Code: Select all

void Snow::Add_collision()
{
	
	scene::ITriangleSelector* selectorSoc1[29];
	ISceneNode *scene_node1[29];
	scene_node1[1] = getSMGR()->getSceneNodeFromName("home2");
	scene_node1[2] = getSMGR()->getSceneNodeFromName("home3");
	scene_node1[3] = getSMGR()->getSceneNodeFromName("home4");
	scene_node1[4] = getSMGR()->getSceneNodeFromName("home5");
	scene_node1[5] = getSMGR()->getSceneNodeFromName("home6");

	int sum = 6;
	for(int i = 1;i <= sum;i++)
	{
		selectorSoc1[i] = getSMGR()->createTriangleSelectorFromBoundingBox(scene_node1[i]);
		scene_node1[i]->setTriangleSelector(selectorSoc1[i]);
		selectorSoc1[i]->drop();
	}
	
	scene::IMetaTriangleSelector *metaTri;
	metaTri = getSMGR()->createMetaTriangleSelector();
	for(i = 1; i<= sum; i++)
	{
	metaTri->addTriangleSelector(selectorSoc1[i]);
	}
		scene::ISceneNodeAnimator* anim = getSMGR()->createCollisionResponseAnimator(
		metaTri, hero->animateMesh, core::vector3df(1,1,1),
		core::vector3df(0,0,0), 
		core::vector3df(1,1,1));

	hero->animateMesh->addAnimator(anim);

}
________
ARIZONA DISPENSARIES
Last edited by koller202 on Thu Feb 17, 2011 1:14 am, edited 1 time in total.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Re: .irr question

Post by vitek »

happyer wrote:If I want to do a collision detection on the .irr file, is it possible?
I've posted code on this several times. You can find information and code in the following posts...

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=19725
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=21292

Travis
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi Koller202.

Your code refer to function "getSMGR()". I don't see it in the SDK can you post the codes to that function?
Wyszo
Posts: 49
Joined: Sun Jun 24, 2007 8:44 am

Post by Wyszo »

Because it's not in SDK
I belive it goes like this:

irr::scene::ISceneManager* getSMGR()
{
return device->getSceneManager();
}

assuming, that device is global variable.
Post Reply