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));