IrrNewt 0.4, slow problem?

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

IrrNewt 0.4, slow problem?

Post by beshrkayali »

hey all,
I'm working on project that has 8 nodes, and a level node
I want all of the 8 nodes to be added to IrrNewt Physics World, but i'm having a problem.
I tried to do it with only one node, it worked fine.
but with 8 nodes, it became soooo slow.

how can i solve this problem?

here i my physics code, i donnu, maybe there is something wrong with it:

Code: Select all

	/////////////////
	//Physics
	/////////////////
	p_world=irr::newton::createPhysicsWorld(device);
	newton::SBodyFromNode balldata;
	balldata.Node=ball_node;
	balldata.Mesh=NULL;
	balldata.Type=newton::EBT_PRIMITIVE_ELLIPSOID;
	ball_p_node=p_world->createBody(balldata);
	
	newton::SBodyFromNode ThingData;
		ThingData.Node=Thing_1;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing1_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_2;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing2_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_3;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing3_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_4;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing4_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_5;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing5_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_6;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing6_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_7;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing7_p_node=p_world->createBody(ThingData);
		ThingData.Node=Thing_8;
		ThingData.Mesh=NULL;
		ThingData.Type=newton::EBT_PRIMITIVE_BOX;
		thing8_p_node=p_world->createBody(ThingData);

	
	newton::IMaterial* ball_material;
		newton::IMaterial* thing_material;
	ball_material=p_world->createMaterial();
		thing_material=p_world->createMaterial();
	ball_p_node->setMaterial(ball_material);
		thing1_p_node->setMaterial(thing_material);
		thing2_p_node->setMaterial(thing_material);
		thing3_p_node->setMaterial(thing_material);
		thing4_p_node->setMaterial(thing_material);
		thing5_p_node->setMaterial(thing_material);
		thing6_p_node->setMaterial(thing_material);
		thing7_p_node->setMaterial(thing_material);
		thing8_p_node->setMaterial(thing_material);

	irr::newton::SBodyFromNode treeData;
	treeData.Node=node;
	treeData.Mesh=mesh->getMesh(0);
	irr::newton::IBody* world_p_node=p_world->createBody(treeData);
	ball_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing1_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing2_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing3_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing4_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing5_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing6_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing7_p_node->addForceContinuous(core::vector3df(0,-55,0));
	thing8_p_node->addForceContinuous(core::vector3df(0,-55,0));
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

answer

Post by beshrkayali »

any one wanna answer me over here????
if there is something wrong with my question, tell me, so i can make it right? it's really really important

:?
white tiger
Posts: 269
Joined: Tue Oct 31, 2006 3:24 pm
Contact:

Post by white tiger »

you should implement graphics debug information (p_world->drawAllDebugInfos() after smgr->drawAll() ) to check that all is ok. Also post the FPS with 1 box and the tree collision body and the FPS with 8 boxes and the tree
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

are you sure it is the physics have you tried comparing results with/without physics? Alot of the time it is graphics issues...
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

Post by beshrkayali »

well, i tried all of these thing.
i turns out that my mesh is really big, or not big, it has a lot of polygons.
i tried another object and it worked fine.
sorry, physics is just Great.
i think that i couldn't do it without IrrNewt.

I think that irrlicht should always come with IrrNewt integrated with it, becasue no one will make a game without physics.


:P
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

beshrkayali wrote:well, i tried all of these thing.
i turns out that my mesh is really big, or not big, it has a lot of polygons.
i tried another object and it worked fine.
sorry, physics is just Great.
i think that i couldn't do it without IrrNewt.

I think that irrlicht should always come with IrrNewt integrated with it, becasue no one will make a game without physics.


:P
You don't need physics for an FPS... or a sidescroller... or a space shooter... or tetris... or many other things.
beshrkayali
Posts: 85
Joined: Mon Jun 11, 2007 11:22 am
Location: Damascus - Syria
Contact:

Post by beshrkayali »

i'm not doing an fps game, check this out:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=22389
Post Reply