Buckcherry
22-06-2006 18:49:42
I want to see the debug object during my game, for that I have added these two lines in the frameStarted method:
OgreNewt::Debugger::getSingleton().init( mSceneMgr );
OgreNewt::Debugger::getSingleton().showLines( mMundo );
But, when I run the game I get this error:
An exception has been thrown!
-------------------------------
Details:
-------------------------------
Error #: 6
Function: OctreeSceneManager::createSceneNode
Description: A scene node with the name __OgreNewt__Debugger__ already exists.
File: \OgreDev\Dagon\PlugIns\OctreeSceneManager\src\OgreOctreeSceneManager.cpp
Line: 537
Stack unwinding: <<beginning of stack>>
What is the problem?.
I tried to remove the first line:
OgreNewt::Debugger::getSingleton().init( mSceneMgr );
And so I do not get any error, but I can not see the rigid body in the screen.
Any idea?
HexiDave
22-06-2006 22:43:33
Are you using a OgreNewt:BasicFrameListener? If so, just hit F3. If you have a custom frame listener for Newton, then search your project files for "__OgreNewt__Debugger__" and see if anything turns up. The BasicFrameListener already has the Debugger initialized.
Buckcherry
22-06-2006 23:38:38
Yes, I am using OgreNewt::BasicFrameListener. And, effectively, hitting F3 I can see the debug objects!!!
:):):). But I have to hold F3 down all the time, when I release the key, the debug object is hidden.
Thanks!!!
HexiDave
23-06-2006 00:21:43
Ya, I currently have my own framelistener for Newton based directly off BasicFrameListener code, but I have too many things on screen and it just explodes - I'm thinking the code for it needs to be changed so it's toggle-able. Currently it recreates everything each frame, so it implodes for most programs.
lonwolf
27-06-2006 11:42:00
if u want to make it toggle-able you can use this chunk of code if you dont have a NewtonFramelistener but just your Ogre custom framelistener
this is in KeyPressed
if(e->getKey()==CEGUI::Key::M)
{
if(hasShowedLines==false)
{
OgreNewt::Debugger::getSingleton().init( mSceneMgr );
OgreNewt::Debugger::getSingleton().showLines( mWorld );
hasShowedLines = true;
}
else
{
OgreNewt::Debugger::getSingleton().hideLines();
OgreNewt::Debugger::getSingleton().deInit();
hasShowedLines=false;
}
}
This works on pressing the M button but you can configure it for any key your heart desire
and this at the end of frameStarted/frameended
if (mShutdownRequested)
{ // etc other testing like water etc.
if(hasShowedLines==true)
{
OgreNewt::Debugger::getSingleton().hideLines();
OgreNewt::Debugger::getSingleton().deInit();
}
return false;
hope it helps any1
And now you dont have to keep that key pressed all the time
HexiDave
27-06-2006 12:26:53
Ah that works nicely - I always thought I'd incur a boat-load of overhead from Init, but this is nice and fast
Thanks very much
lonwolf
27-06-2006 12:37:02
no problem
at least this code works fine
cuz im having some problem with scaling some bodyes... i really dont know how..
anyway im glad it helped some1
(now im in need of help
)
HexiDave
27-06-2006 13:32:17
I haven't tried it myself, but I'd imagine you're stuck re-creating the body after you find the scale you want.
lonwolf
27-06-2006 13:40:18
OgreNewt::Collision* colDotScen = new OgreNewt::CollisionPrimitives::TreeCollision( mWorld, pObjNode, true );
bodDotScen = new OgreNewt::Body( mWorld, colDotScen );
delete colDotScen;
bodDotScen->attachToNode( pObjNode );
bodDotScen->setPositionOrientation(pObjNode->getPosition(), pObjNode->getOrientation());
Ive been using TreeCollisionSceneParser and my bodyes were.. well lets say not like the entityes... and i replaced with the code above and everything works fine