Irrlicht with Bullet Softbody sample sourcecode
Re: Irrlicht with Bullet Softbody sample sourcecode
I solved the problem with cubeSoftBody->addForce(btVector3(0,10050, 0 ), 10); since I suppose it was reacting to the force but its magnitude was low. I increased the forces magnitude & now it seems to be working fine. Now I am trying to add other models but the i is showing certain part of it & not the entire model. The person responsible for this code said the simulation would be slow if indexcount is greater than 2000 but nothing about it being shown partly. Please help me.
Re: Irrlicht with Bullet Softbody sample sourcecode
just a question how do you step the world?
also just calling addforce apply a force per frame wich mean that a much lower framerate computer would have a much slower acceleration rate
also just calling addforce apply a force per frame wich mean that a much lower framerate computer would have a much slower acceleration rate
Re: Irrlicht with Bullet Softbody sample sourcecode
Step simulation part-->
while(device->run())
{
dynamicsWorld->stepSimulation(1/15.0f, 1);
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;
btSoftBody::Node* node = vertices.find(index)->second;
mb_vertices.Pos.X = node->m_x.x();
mb_vertices.Pos.Y = node->m_x.y();
mb_vertices.Pos.Z = -node->m_x.z();
}
if(receiver.IsKeyDown(irr::KEY_SPACE)){
// qDebug() << "HI";
cubeSoftBody->addForce(btVector3(0,10050, 0 ), 10);
}
else if(receiver.IsKeyDown(irr::KEY_ESCAPE))
break;
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
}
I tried playing with stepsimulation parameters but no change at all. Let me know about the partial model. Indexcount is 8000 something but the program takes in only 2000 something.
while(device->run())
{
dynamicsWorld->stepSimulation(1/15.0f, 1);
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;
btSoftBody::Node* node = vertices.find(index)->second;
mb_vertices.Pos.X = node->m_x.x();
mb_vertices.Pos.Y = node->m_x.y();
mb_vertices.Pos.Z = -node->m_x.z();
}
if(receiver.IsKeyDown(irr::KEY_SPACE)){
// qDebug() << "HI";
cubeSoftBody->addForce(btVector3(0,10050, 0 ), 10);
}
else if(receiver.IsKeyDown(irr::KEY_ESCAPE))
break;
driver->beginScene(true, true, SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
}
I tried playing with stepsimulation parameters but no change at all. Let me know about the partial model. Indexcount is 8000 something but the program takes in only 2000 something.
Re: Irrlicht with Bullet Softbody sample sourcecode
I am trying to merge the provided code with Qt. This is my simulation. It is printing 7,8,9 but not displaying anything.
void MainWindow::drawIrrlichtScene()
{
qDebug() << "MainWindow::drawIrrlichtScene()";
while(m_Device->run())
{
qDebug() << "start simulation" << endl;
m_dynamicsWorld->stepSimulation(1/60.0f, 1);qDebug() << "0";
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;/*qDebug() << "1";*/
btSoftBody::Node* node = vertices.find(index)->second;/*qDebug() << "2";*/
mb_vertices.Pos.X = node->m_x.x();/*qDebug() << "3";*/
mb_vertices.Pos.Y = node->m_x.y();/*qDebug() << "4";*/
mb_vertices.Pos.Z = -node->m_x.z();/*qDebug() << "5";*/
}
// if(m_receiver->IsKeyDown(irr::KEY_SPACE)){
// qDebug() << "HI";
// m_cubeSoftBody->addForce(btVector3(0,10050, 0), 10);qDebug() << "6";
// }
m_Driver->beginScene( true, false, SColor( 255, 128, 128, 128 ));qDebug() << "7";
m_Scene->drawAll();qDebug() << "8";
m_Driver->endScene();qDebug() << "9";
}
}
Let me know.
void MainWindow::drawIrrlichtScene()
{
qDebug() << "MainWindow::drawIrrlichtScene()";
while(m_Device->run())
{
qDebug() << "start simulation" << endl;
m_dynamicsWorld->stepSimulation(1/60.0f, 1);qDebug() << "0";
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;/*qDebug() << "1";*/
btSoftBody::Node* node = vertices.find(index)->second;/*qDebug() << "2";*/
mb_vertices.Pos.X = node->m_x.x();/*qDebug() << "3";*/
mb_vertices.Pos.Y = node->m_x.y();/*qDebug() << "4";*/
mb_vertices.Pos.Z = -node->m_x.z();/*qDebug() << "5";*/
}
// if(m_receiver->IsKeyDown(irr::KEY_SPACE)){
// qDebug() << "HI";
// m_cubeSoftBody->addForce(btVector3(0,10050, 0), 10);qDebug() << "6";
// }
m_Driver->beginScene( true, false, SColor( 255, 128, 128, 128 ));qDebug() << "7";
m_Scene->drawAll();qDebug() << "8";
m_Driver->endScene();qDebug() << "9";
}
}
Let me know.
Re: Irrlicht with Bullet Softbody sample sourcecode
I am trying to embed the code into Qt. the model displays perfectly if i don't use the stepsimulation part. As I add the step simulation the model is not being displayed. I really need this. Please help me out.
void CurioModel::drawIrrlichtScene()
{
u32 TimeStamp = m_Device->getTimer()->getTime();
u32 DeltaTime = 0;
// while(m_Device->run())
{
qDebug() << "start simulation";
m_Driver->beginScene(true, true, SColor(255,100,101,140));
DeltaTime = m_Device->getTimer()->getTime() - TimeStamp;
TimeStamp = m_Device->getTimer()->getTime();
m_dynamicsWorld->stepSimulation(DeltaTime*0.001f, 120);
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;
btSoftBody::Node* node = vertices.find(index)->second;
mb_vertices.Pos.X = node->m_x.x();
mb_vertices.Pos.Y = node->m_x.y();
mb_vertices.Pos.Z = -node->m_x.z();
}
m_Scene->drawAll();
m_Driver->endScene();
}
}
void CurioModel::drawIrrlichtScene()
{
u32 TimeStamp = m_Device->getTimer()->getTime();
u32 DeltaTime = 0;
// while(m_Device->run())
{
qDebug() << "start simulation";
m_Driver->beginScene(true, true, SColor(255,100,101,140));
DeltaTime = m_Device->getTimer()->getTime() - TimeStamp;
TimeStamp = m_Device->getTimer()->getTime();
m_dynamicsWorld->stepSimulation(DeltaTime*0.001f, 120);
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;
btSoftBody::Node* node = vertices.find(index)->second;
mb_vertices.Pos.X = node->m_x.x();
mb_vertices.Pos.Y = node->m_x.y();
mb_vertices.Pos.Z = -node->m_x.z();
}
m_Scene->drawAll();
m_Driver->endScene();
}
}
Re: Irrlicht with Bullet Softbody sample sourcecode
@rookie: Just 2 minor feastures of the forum which you might be missing:
1. You can edit old posts. So if you only want to change a line you can just click edit and do that.
2. There is code tag. You can see tags directly above the edit-field when posting (click on full edit if you do only a quick-reply to see those). That makes code a lot more readable!
1. You can edit old posts. So if you only want to change a line you can just click edit and do that.
2. There is code tag. You can see tags directly above the edit-field when posting (click on full edit if you do only a quick-reply to see those). That makes code a lot more readable!
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Irrlicht with Bullet Softbody sample sourcecode
I am trying to merge the code with Qt. I am performing all functions inside a class which is derived from QGraphicsItem. I am calling the following function inside paint function of the derived class. It prints start simulation but it doesn't display anything not even the rigid body inside the new window which opens up when I declare a object of the derived class. I have declared classes derived from QGraphicsView & QGraphicsScene. Model is the class derived from QGraphicsItem. Please help me. I am stuck here.
Code: Select all
void Model::drawIrrlichtScene()
{
u32 TimeStamp = m_Device->getTimer()->getTime();
u32 DeltaTime = 0;
// while(m_Device->run())
// {
qDebug() << "start simulation";
m_Driver->beginScene(true, true, SColor(255,100,101,140));
DeltaTime = m_Device->getTimer()->getTime() - TimeStamp;
TimeStamp = m_Device->getTimer()->getTime();
m_dynamicsWorld->stepSimulation(DeltaTime*0.001f, 120);
for (int i=0; i<mb->getVertexCount(); i++)
{
int index = testMesh_map.find(i)->second;
btSoftBody::Node* node = vertices.find(index)->second;
mb_vertices[i].Pos.X = node->m_x.x();
mb_vertices[i].Pos.Y = node->m_x.y();
mb_vertices[i].Pos.Z = -node->m_x.z();
}
m_Scene->drawAll();
m_Driver->endScene();
// }
}
Re: Irrlicht with Bullet Softbody sample sourcecode
i just started working on the soft body exemple it works but i don't understand at all how it does