Posted: Thu May 05, 2011 5:48 am
You could try ISceneManager::addToDeletionQueue instead of removing the node directly. That way it will be removed once it's safe to do so.
Official forum of the Irrlicht Engine
https://irrlicht.sourceforge.io/forum/
Code: Select all
CIrrOdeSurfaceParameters g_pParams2;
g_pParams2.setMode(dContactBounce | dContactSoftERP | dContactSoftCFM | dContactSlip1 | dContactSlip2);
g_pParams2.setMu(dInfinity);
g_pParams2.setMu2(0);
g_pParams2.setBounce((dReal)0.6);
g_pParams2.setBounceVel(1e-9f);
g_pParams2.setSoftCfm(0.005f);
g_pParams2.setSoftErp(0.00005f);
g_pParams2.setSlip1(1.0f);
g_pParams2.setSlip2(1.0f);
ISceneNode* irrNode = smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_BODY_NAME), worldNode);
CIrrOdeBody *pBody = reinterpret_cast<CIrrOdeBody *>(irrNode);
pBody->setPosition(vector3df(5.0,15.0f,5.0f));
IAnimatedMesh *Mesh;
IAnimatedMeshSceneNode *Node;
Mesh = smgr->getMesh("../../media/sphere.3ds");
Node = smgr->addAnimatedMeshSceneNode(Mesh, pBody);
Node->setMaterialTexture(0, driver->getTexture("../../media/arizona.png"));
Node->setMaterialFlag(EMF_LIGHTING, false);
Node->addShadowVolumeSceneNode();
ISceneNode* irrSphere = smgr->addSceneNode(CIrrOdeSceneNode::nodeNameToC8(IRR_ODE_GEOM_SPHERE_NAME), Node);
CIrrOdeGeomSphere *pSphere = reinterpret_cast<CIrrOdeGeomSphere *>(irrSphere);
pSphere->setMassTotal(0.5f);
pSphere->setSurfaceParameters(&g_pParams2, 0);
pSphere->drop();
pBody->initPhysics();
pBody->drop();
smgr->addToDeletionQueue(pBody);
Code: Select all
void CIrrOdeBody::doRemoveFromPhysics() {
CIrrOdeSceneNode::removeFromPhysics();
if (m_iBodyId) {
if (m_pWorld)
m_pWorld->removeBody(this);
m_pOdeManager->removeTreeFromPhysics(this);
m_pOdeManager->removeOdeSceneNode(this);
m_pOdeDevice->bodyDestroy(m_iBodyId);
m_iBodyId=0;
}
else if (!m_bPhysicsInitialized && m_pWorld!=NULL) m_pWorld->removeBody(this);
}
Code: Select all
1>------ Rebuild All started: Project: myIrrOde01, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'myIrrOde01', configuration 'Debug|Win32'
1>Compiling...
1>main.cpp
1>c:\irrode\include\irrode\cserializer.h(148) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\irrode\include\irrode\cserializer.h(273) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\irrode\include\irrode\event\cirrodeeventbodymoved.h(50) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\irrode\include\irrode\event\cirrodeeventbodymoved.h(51) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\irrode\include\irrode\event\cirrodeeventbodymoved.h(52) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\irrode\include\irrode\event\cirrodeeventbodymoved.h(53) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>c:\irrode\include\irrode\event\cirrodeeventbodymoved.h(54) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1>LINK : C:\Users\newleon\Documents\Visual Studio 2008\Projects\myIrrOde01\Debug\myIrrOde01.exe not found or not built by the last incremental link; performing full link
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CConfigFileManager::writeConfig(class irr::IrrlichtDevice *,char const *)" (?writeConfig@CConfigFileManager@@QAEXPAVIrrlichtDevice@irr@@PBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CConfigFileManager::loadConfig(class irr::IrrlichtDevice *,char const *)" (?loadConfig@CConfigFileManager@@QAEXPAVIrrlichtDevice@irr@@PBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CHeli::CHeli(class irr::IrrlichtDevice *,class irr::scene::ISceneNode *,class CIrrCC *)" (??0CHeli@@QAE@PAVIrrlichtDevice@irr@@PAVISceneNode@scene@2@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CTank::CTank(class irr::IrrlichtDevice *,class irr::scene::ISceneNode *,class CIrrCC *)" (??0CTank@@QAE@PAVIrrlichtDevice@irr@@PAVISceneNode@scene@2@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CPlane::CPlane(class irr::IrrlichtDevice *,class irr::scene::ISceneNode *,class CIrrCC *)" (??0CPlane@@QAE@PAVIrrlichtDevice@irr@@PAVISceneNode@scene@2@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CMenu::addButtonForState(class CIrrOdeCarState *)" (?addButtonForState@CMenu@@QAEXPAVCIrrOdeCarState@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CIrrOdeCarState::setFpsInfo(class irr::gui::IGUIStaticText *)" (?setFpsInfo@CIrrOdeCarState@@QAEXPAVIGUIStaticText@gui@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CCar::CCar(class irr::IrrlichtDevice *,class irr::scene::ISceneNode *,class CIrrCC *)" (??0CCar@@QAE@PAVIrrlichtDevice@irr@@PAVISceneNode@scene@2@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CController::CController(class irr::IrrlichtDevice *,class CIrrCC *)" (??0CController@@QAE@PAVIrrlichtDevice@irr@@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CMenu::CMenu(class irr::IrrlichtDevice *,class CIrrCC *)" (??0CMenu@@QAE@PAVIrrlichtDevice@irr@@PAVCIrrCC@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CAdvancedParticleSystemNodeFactory::CAdvancedParticleSystemNodeFactory(class irr::scene::ISceneManager *)" (??0CAdvancedParticleSystemNodeFactory@@QAE@PAVISceneManager@scene@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CRandomForestFactory::CRandomForestFactory(class irr::scene::ISceneManager *)" (??0CRandomForestFactory@@QAE@PAVISceneManager@scene@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CIrrCC::createFader(unsigned int,unsigned int,unsigned int,float)" (?createFader@CIrrCC@@QAEXIIIM@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CIrrCC::createAxis(unsigned int,unsigned int)" (?createAxis@CIrrCC@@QAEXII@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall CIrrCC::addItem(unsigned int,class irr::core::string<wchar_t,class irr::core::irrAllocator<wchar_t> >,enum irr::EKEY_CODE,enum CIrrCC::eControllerType)" (?addItem@CIrrCC@@QAEIIV?$string@_WV?$irrAllocator@_W@core@irr@@@core@irr@@W4EKEY_CODE@4@W4eControllerType@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CConfigFileManager::addWriter(class IConfigFileWriter *)" (?addWriter@CConfigFileManager@@QAEXPAVIConfigFileWriter@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CConfigFileManager::addReader(class IConfigFileReader *)" (?addReader@CConfigFileManager@@QAEXPAVIConfigFileReader@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: static class CConfigFileManager * __cdecl CConfigFileManager::getSharedInstance(void)" (?getSharedInstance@CConfigFileManager@@SAPAV1@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CIrrCC::setAllowMouse(bool)" (?setAllowMouse@CIrrCC@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CIrrCC::setAllowFKeys(bool)" (?setAllowFKeys@CIrrCC@@QAEX_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CIrrCC::CIrrCC(class irr::IrrlichtDevice *)" (??0CIrrCC@@QAE@PAVIrrlichtDevice@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CCustomEventReceiver::install(void)" (?install@CCustomEventReceiver@@QAEXXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: static class CCustomEventReceiver * __cdecl CCustomEventReceiver::getSharedInstance(void)" (?getSharedInstance@CCustomEventReceiver@@SAPAV1@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl CCustomEventReceiver::setMembers(class irr::IrrlichtDevice *,class irr::ode::CIrrOdeManager *)" (?setMembers@CCustomEventReceiver@@SAXPAVIrrlichtDevice@irr@@PAVCIrrOdeManager@ode@3@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: class irr::IrrlichtDevice * __thiscall CSettings::createDeviceFromSettings(void)" (?createDeviceFromSettings@CSettings@@QAEPAVIrrlichtDevice@irr@@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: unsigned int __thiscall CSettings::run(void)" (?run@CSettings@@QAEIXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CSettings::addValidDriver(wchar_t const *,enum irr::video::E_DRIVER_TYPE)" (?addValidDriver@CSettings@@QAEXPB_WW4E_DRIVER_TYPE@video@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CSettings::CSettings(char const *,wchar_t const *,class irr::video::SColor)" (??0CSettings@@QAE@PBDPB_WVSColor@video@irr@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall CProgressBar::CProgressBar(class irr::gui::IGUIEnvironment *,class irr::core::rect<int> const &,int,class irr::gui::IGUIElement *)" (??0CProgressBar@@QAE@PAVIGUIEnvironment@gui@irr@@ABV?$rect@H@core@3@HPAVIGUIElement@23@@Z) referenced in function "public: __thiscall CProgress::CProgress(class irr::IrrlichtDevice *)" (??0CProgress@@QAE@PAVIrrlichtDevice@irr@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall CProgressBar::setProgress(unsigned int)" (?setProgress@CProgressBar@@QAEXI@Z) referenced in function "public: virtual bool __thiscall CProgress::onEvent(class irr::ode::IIrrOdeEvent *)" (?onEvent@CProgress@@UAE_NPAVIIrrOdeEvent@ode@irr@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall CRandomForestFactory::~CRandomForestFactory(void)" (??1CRandomForestFactory@@UAE@XZ) referenced in function "public: void __thiscall CRandomForestFactory::`vbase destructor'(void)" (??_DCRandomForestFactory@@QAEXXZ)
1>C:\Users\newleon\Documents\Visual Studio 2008\Projects\myIrrOde01\Debug\myIrrOde01.exe : fatal error LNK1120: 31 unresolved externals
1>Build log was saved at "file://c:\Users\newleon\Documents\Visual Studio 2008\Projects\myIrrOde01\myIrrOde01\Debug\BuildLog.htm"
1>myIrrOde01 - 32 error(s), 7 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Code: Select all
.objs/source/IrrOdeCar/CCar.o||In function `CCar::CCar(irr::IrrlichtDevice*, irr::scene::ISceneNode*, CIrrCC*)':|
CCar.cpp|| undefined reference to `typeinfo for irr::ode::CIrrOdeMotor'|
CCar.cpp|| undefined reference to `typeinfo for irr::ode::CIrrOdeMotor'|
CCar.cpp|| undefined reference to `typeinfo for irr::ode::CIrrOdeServo'|
CCar.cpp|| undefined reference to `typeinfo for irr::ode::CIrrOdeServo'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
.objs/source/IrrOdeCar/CCar.o||In function `CCar::~CCar()':|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
.objs/source/IrrOdeCar/CCar.o||In function `CCar::deactivate()':|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setVelocity(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setForce(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeServo::setServoPos(float)'|
.objs/source/IrrOdeCar/CCar.o||In function `CCar::update()':|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
.objs/source/IrrOdeCar/CCar.o||In function `CCar::onEvent(irr::ode::IIrrOdeEvent*)':|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setVelocity(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setForce(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setVelocity(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setForce(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeServo::setServoPos(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeServo::setServoPos(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setVelocity(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeMotor::setForce(float)'|
CCar.cpp|| undefined reference to `irr::ode::CIrrOdeBody::addForceAtPosition(irr::core::vector3d<float>, irr::core::vector3d<float>)'|
.objs/source/IrrOdeCar/CHeli.o||In function `CHeli::CHeli(irr::IrrlichtDevice*, irr::scene::ISceneNode*, CIrrCC*)':|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
.objs/source/IrrOdeCar/CHeli.o||In function `CHeli::~CHeli()':|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
.objs/source/IrrOdeCar/CHeli.o||In function `CHeli::update()':|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
.objs/source/IrrOdeCar/CHeli.o||In function `CHeli::onEvent(irr::ode::IIrrOdeEvent*)':|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
CHeli.cpp|| undefined reference to `irr::ode::CIrrOdeBody::addForceAtPosition(irr::core::vector3d<float>, irr::core::vector3d<float>)'|
.objs/source/IrrOdeCar/CIrrOdeCarState.o||In function `CIrrOdeCarState::OnEvent(irr::SEvent const&)':|
CIrrOdeCarState.cpp|| undefined reference to `irr::ode::CIrrOdeRecorder::CIrrOdeRecorder(irr::IrrlichtDevice*, char const*)'|
CIrrOdeCarState.cpp|| undefined reference to `irr::ode::CIrrOdeRecorder::startRecording()'|
CIrrOdeCarState.cpp|| undefined reference to `irr::ode::CIrrOdeRecorder::stopRecording()'|
CIrrOdeCarState.cpp|| undefined reference to `irr::ode::CIrrOdeRecorder::saveRecording(char const*)'|
CIrrOdeCarState.cpp|| undefined reference to `irr::ode::CIrrOdeRecorder::~CIrrOdeRecorder()'|
.objs/source/IrrOdeCar/CPlane.o||In function `CPlane::CPlane(irr::IrrlichtDevice*, irr::scene::ISceneNode*, CIrrCC*)':|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getMotorFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getStepMotorFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getChildBodyFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getChildBodyFromName(char const*)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
.objs/source/IrrOdeCar/CPlane.o||In function `CPlane::~CPlane()':|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
.objs/source/IrrOdeCar/CPlane.o||In function `CPlane::update()':|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
.objs/source/IrrOdeCar/CPlane.o||In function `CPlane::onEvent(irr::ode::IIrrOdeEvent*)':|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeServo::setServoPos(float)'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getID()'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::getLinearVelocity()'|
CPlane.cpp|| undefined reference to `irr::ode::CIrrOdeBody::addForceAtPosition(irr::core::vector3d<float>, irr::core::vector3d<float>)'|
.objs/source/IrrOdeCar/CProjectile.o||In function `CProjectile::CProjectile(irr::scene::ISceneManager*, irr::core::vector3d<float>, irr::core::vector3d<float>, irr::core::vector3d<float>, char const*, int, irr::scene::ISceneNode*, bool)':|
CProjectile.cpp|| undefined reference to `irr::ode::CIrrOdeManager::getSharedInstance()'|
CProjectile.cpp|| undefined reference to `irr::ode::CIrrOdeManager::cloneTree(irr::scene::ISceneNode*, irr::scene::ISceneNode*, irr::scene::ISceneManager*)'|
CProjectile.cpp|| undefined reference to `irr::ode::CIrrOdeBody::setLinearVelocity(irr::core::vector3d<float>)'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|