DebugDrawer and Static Shapes

Topper

09-11-2010 09:47:50

Hi,

ist there a way to show the debug container of static shapes? I can only see the container of non static shapes.


mDebugDrawer = new OgreBulletCollisions::DebugDrawer();
mDebugDrawer->setDebugMode(OgreBulletCollisions::DebugDrawer::DBG_MAX_DEBUG_DRAW_MODE);
mDebugDrawer->setDrawAabb(true);
mDebugDrawer->setDrawWireframe(true);
mDebugDrawer->setDrawContactPoints(true);
mDebugDrawer->setDrawFeaturesText(true);


mWorld->setDebugDrawer(mDebugDrawer);
mWorld->setShowDebugShapes(true);
Ogre::SceneNode *node = mgr->getRootSceneNode()->createChildSceneNode("debugDrawer", Ogre::Vector3::ZERO);
node->attachObject(static_cast <Ogre::SimpleRenderable *> (mDebugDrawer));

TWO

13-04-2011 15:11:58

Second this question, static shapes are not drawn

dermont

14-04-2011 12:01:23

Assuming you already have a static body with something like:


defaultBody->setStaticShape(
myStaticShape,
0.6f,
0.6f,
ent->getParentSceneNode()->_getDerivedPosition(),
ent->getParentSceneNode()->_getDerivedOrientation());


Then try updating the scene node debug drawer node in your frameRenderingQueued/Started before you do a stepSimulation.

Ogre::SceneNode *drawnode;

drawnode = mSceneMgr->getRootSceneNode()->createChildSceneNode("debugDrawer", Ogre::Vector3::ZERO);
drawnode->attachObject(static_cast <SimpleRenderable *> (debugDrawer));

----> drawnode->_update(true,true);



Also I think you could also attach the debug shape to the entities parent node and use setShowDebugShapes:


defaultBody->setShape(ent->getParentSceneNode(),
myStaticShape,
0.6f,
0.6f,
0.0,
ent->getParentSceneNode()->_getDerivedPosition(),
ent->getParentSceneNode()->_getDerivedOrientation());


or even create your own static debug node (??)

mDebugNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("DEBUG");
OgreBulletCollisions::StaticMeshToShapeConverter* converter;

Entity* ent = mSceneMgr->createEntity("head", "ogrehead.mesh");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
converter = new OgreBulletCollisions::StaticMeshToShapeConverter(ent, ent->_getParentNodeFullTransform());

Entity* ent2 = mSceneMgr->createEntity("head2", "ogrehead.mesh");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent2);
ent2->getParentSceneNode()->setPosition(Ogre::Vector3(100,100,100));
converter->addEntity(ent2, ent2->_getParentNodeFullTransform());

OgreBulletCollisions::TriangleMeshCollisionShape* sceneBoxShape = converter->createTrimesh();

defaultBody->setStaticShape(
mDebugNode,
sceneBoxShape,
0.6f,
0.6f,
ent->getParentSceneNode()->_getDerivedPosition(),
ent->getParentSceneNode()->_getDerivedOrientation());