durmieu
25-09-2007 00:28:44
I've starting a game with ogrenewt and I'm having some trouble with setCustomForceAndTorqueCallback. When I run the app I get a "Fallo de segmentación (core dumped)".
The callback function is as follows:
and y call it this way (form inside TestState)
Compiles fine, but then Boooom! Here is the stacktrace from gdb:
I tried with bod->setCustomForceAndTorqueCallback(forceCallback); and the function outside the class and got the same result. Did I make any mistake or is it a OgreNewt bug? Is there any workaround? Another way to apply forces?
Thank you,
The callback function is as follows:
void TestState::forceCallback(OgreNewt::Body* me){
me->addLocalForce(Vector3(0,-10,0),Vector3::ZERO);
}
and y call it this way (form inside TestState)
bod->setCustomForceAndTorqueCallback<TestState>(&TestState::forceCallback,this);
Compiles fine, but then Boooom! Here is the stacktrace from gdb:
(gdb) bt
#0 0x08140015 in ?? ()
#1 0xb7f62131 in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::assign_to_own () from /usr/lib/libOgreNewt.so
#2 0xb7f6217b in boost::function1<void, OgreNewt::Body*, std::allocator<void> >::function1 () from /usr/lib/libOgreNewt.so
#3 0xb7f621a6 in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::function () from /usr/lib/libOgreNewt.so
#4 0xb7f62a36 in boost::function<void ()(OgreNewt::Body*), std::allocator<void> >::operator= () from /usr/lib/libOgreNewt.so
#5 0xb7f60eaf in OgreNewt::Body::setCustomForceAndTorqueCallback ()
from /usr/lib/libOgreNewt.so
#6 0x0810ee07 in TestState::enter (this=0x813fe40)
at /usr/include/OgreNewt/OgreNewt_Body.h:162
#7 0x08107cf6 in GameManager::changeState (this=0x81450d0, state=0x813fe40)
at GameManager.cpp:55
#8 0x08108d5b in GameManager::start (this=0x81450d0, state=0x813fe40)
at GameManager.cpp:40
#9 0x0810793f in main () at Main.cpp:21
I tried with bod->setCustomForceAndTorqueCallback(forceCallback); and the function outside the class and got the same result. Did I make any mistake or is it a OgreNewt bug? Is there any workaround? Another way to apply forces?
Thank you,