Has anyone successfully integrated OgreBullet and the PCZSM?
I have an implementation that works great in debug mode (MSVC) but crashes in release mode. The best I can tell (at this point) is the crash occurs when OgreBullet tries to add a scene node for a physical object, like a capsule or even an AABB. Again, the crash occurs only in release mode.
I know that the PCZSM requires the use of the PCZSceneNode* casting as opposed to the standard Ogre::SceneNode* casting. If OgreBullets use of the SceneNode* casting was a problem I would expect the app to fail in debug mode also, but it doesn't.
The crash message is not very helpful and neither is the Ogre Log. The crash message tells me that the app is being closed because it tried to access protected memory at 0X000039.
Any clues?
Here is the stack trace as best as I can tell:
The app crashes upon returning from _notifyAttached() with an access violation reading location 0x00000094. The "if (mListener && different)" test fails, jumps over that 'if' block, reaches the very end of the '_notifyAttached' code block and crashes. It seems as if there is some stack corruption or maybe a buffer overrun somehow. Any clues? Chaster? Tuan?
MovableObject::_notifyAttached()
SceneNode::attachObject()
RigidBody::setShape()
FishApplication::createScene()
This only happens when using the PCZSM with OgreBullet in release mode. The TerrainSceneManager and OgreBullet work fine in release mode.
As best I can tell, OgreBullet creates scene nodes that PCZSM does not like, possibly producing a buffer overrun or corrupting the stack. The scene nodes do not appear to have any function within OgreBullet or Bullet. One possible use for them (I think) is to draw the bounding volume that is used for collisions.
I'm too lazy to fix the code to work properly with the PCZSM so I just commented out the code and it seems to work wonderfully with PCZSM. Following is the .patch with the changes.
Index: Collisions/include/OgreBulletCollisionsObject.h
===================================================================
--- Collisions/include/OgreBulletCollisionsObject.h (revision 2504)
+++ Collisions/include/OgreBulletCollisionsObject.h (working copy)
@@ -101,7 +101,7 @@
protected:
Ogre::SceneNode* mRootNode;
- Ogre::SceneNode* mShapeNode;
+// Ogre::SceneNode* mShapeNode;
Ogre::SceneNode* mDebugNode;
ObjectState * mState;
Index: Collisions/src/OgreBulletCollisionsObject.cpp
===================================================================
--- Collisions/src/OgreBulletCollisionsObject.cpp (revision 2504)
+++ Collisions/src/OgreBulletCollisionsObject.cpp (working copy)
@@ -51,7 +51,7 @@
mRootNode(0),
mBounds(Vector3::ZERO, Vector3::ZERO),
mDebugShape(0),
- mShapeNode(0),
+// mShapeNode(0),
mDebugNode(0)
{
if (init)
@@ -66,8 +66,8 @@
if (mRootNode)
{
showDebugShape(false);
- mShapeNode->detachObject (this);
- mRootNode->removeAndDestroyChild (mShapeNode->getName ());
+// mShapeNode->detachObject (this);
+// mRootNode->removeAndDestroyChild (mShapeNode->getName ());
//mRootNode->getParentSceneNode ()->removeAndDestroyChild (mRootNode->getName ());
}
@@ -136,8 +136,8 @@
mShape = shape;
mRootNode = mWorld->getSceneManager()->getRootSceneNode()->createChildSceneNode(mName, pos, quat);
- mShapeNode = mRootNode->createChildSceneNode(mName + "Shape");
- mShapeNode->attachObject(this);
+// mShapeNode = mRootNode->createChildSceneNode(mName + "Shape");
+// mShapeNode->attachObject(this);
mObject->setCollisionShape(shape->getBulletShape());
showDebugShape(mWorld->getShowDebugShapes());
Index: Dynamics/src/OgreBulletDynamicsRigidBody.cpp
===================================================================
--- Dynamics/src/OgreBulletDynamicsRigidBody.cpp (revision 2504)
+++ Dynamics/src/OgreBulletDynamicsRigidBody.cpp (working copy)
@@ -66,8 +66,8 @@
mState = new ObjectState(this);
mRootNode = node;
- mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
- mShapeNode->attachObject(this);
+// mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
+// mShapeNode->attachObject(this);
node->setPosition (pos);
node->setOrientation (quat);
@@ -100,8 +100,8 @@
mRootNode = node;
- mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
- mShapeNode->attachObject(this);
+// mShapeNode = mRootNode->createChildSceneNode(mName + "Node");
+// mShapeNode->attachObject(this);
node->setPosition (pos);
node->setOrientation (quat);
-Fish
Chaster
12-11-2008 04:08:28
I use Bullet (note not "OgreBullet") with PCZSM in my project. It works pretty darn well. I first tried using OgreBullet, but then decided that it would be better for me to do my own wrapper for Bullet which is what I ended up doing. Some of the stuff in OgreBullet (mostly utility functions) I used in my code, but much I just left out for simplicity sake.
Just an FYI..
Chaster
The thought crossed my mind to do the same thing Chaster. But frankly I'm just too lazy