nxOgre::scene::findBody() error

CaseyB

22-04-2006 01:27:32

When I use nxOgre::scene::findBody() find body I get a really strange linker error! It saysListener.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class nxOgre::body * __thiscall nxOgre::scene::findBody(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (__imp_?findBody@scene@nxOgre@@QAEPAVbody@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)I call it like thisnxScene->findBody("Guy")->addForce(Vector3(0, 1, 0)); am I doing something wrong?

betajaen

22-04-2006 08:01:57

It seems it was my fault, I added the definition in the scene header file, but not the actual code!!

Unless you want to add it yourself, you can use the iterators instead which you can use to the same thing:-


nxOgre::bodyIterator* it = new bodyIterator(mScene);
while( body* b = it->next()) {
if (b->getName() == "Guy") {
b->addForce(Vector3(0,1,0));
break;
}
}
delete it;


Infact looking at that code above, is pretty much what the findBody code would be (apart from the guy bit!) :D

[Edit]

Here is one findBody() code, untested of course! Just shove that in NxOgre_Scene.cpp somewhere:


body* scene::findBody(Ogre::String _body) {

nxOgre::bodyIterator* it = new bodyIterator(this);

while( body* b = it->next()) {
if (b->getName() == _body)
delete it;
return b;
}

delete it;
return false;
}

CaseyB

22-04-2006 09:12:59

Phew! Thought that I was just going crazy! :D

betajaen

22-04-2006 09:55:25

Phew! Thought that I was just going crazy! :D

Nope, it's only me is going crazy. :D

CaseyB

22-04-2006 23:10:10

I put that code in and it works perfectly! Thanks!

betajaen

22-04-2006 23:35:53

I put that code in and it works perfectly! Thanks!

No problem! :D