crash on hideline (noob question)

Narf

27-11-2006 20:08:38

hi, i started using ogrenewt few days earlier and i have some little problems with it.

I assume it's something stupid i forgot, but i can't put the finger on it so i ask to people that might know better.

it's simple, i create my world on the constructor like this

m_World = new OgreNewt::World();

then i use this, when l is pressed i want to show the lines of collision bodies


if (keybuf->get_nbPressed(KC_L))
{
if (!debug_collision)
{
OgreNewt::Debugger::getSingleton().init( mSceneMgr );
OgreNewt::Debugger::getSingleton().showLines( m_World );
debug_collision = true;


}
else
{

OgreNewt::Debugger::getSingleton().hideLines();
OgreNewt::Debugger::getSingleton().deInit();
debug_collision=false;
}
}


The problem is, that the program crash each time i press a second time the L button.
I made tests, and, after the
"OgreNewt::Debugger::getSingleton().showLines( m_World );"
either, deinit or hideline makes the program crash.

Somebody know why?


Oh and another question, is there a way to move the newton body in the same time as a scenenode? (like attaching it to the node)
I want that, if i translate a node, the newton body follow it.

Oh and another thing:
I'm just looking at Newton to see if it would be interesting for me to use it, but maybe you can help me.
All i need is to detect collision with more accuracy than bounding boxes, i have no need of others physics.

Am i wrong by trying to use Newton for this?
Any advice on what to use instead?

Ok, ok, i have no more question for now. Thanks for your futur answers.

unclepauly

29-11-2006 14:51:52

1 - why dont you just hit F3 to get the debug lines?? this functionality is already bulit into OgreNewt.

2 - once yuo attach your ogre scene node to your ogrenewt body, forget about the scene node. move the body and the scene node moves with it!

3 - i dont understand. what collision object are you currently using? a box? if you have more complex shapes (like a car or something), use a convex hull. this gives you a collision object the same 'size' as your ogre mesh

Narf

02-12-2006 21:39:57

1- Later I'd like to do my own frameListener, but i'll go with the basic one for the moment.

2- I know this, just wanted to know if there were any way to do it in the other side, moving a newtonBody when a node is moved.

3- Iknow i know, i use convex shapes, it looks ok.
I wanted to have advices about using ogre only for collision check was "a lot of work for nothing" or if there was others tools that could do the job better.


For the bug, it happen on debug mode, when i run the release one, everything is just fine, but on debug mode it's crashing when i press f3...

unclepauly

03-12-2006 12:13:09


2- I know this, just wanted to know if there were any way to do it in the other side, moving a newtonBody when a node is moved.


if it was the node you wanted to move first, then after it has been moved, you would get the new position and the orientation of the node and call setPositionOrientation(pos, orient) on the newton body.


3- Iknow i know, i use convex shapes, it looks ok.
I wanted to have advices about using ogre only for collision check was "a lot of work for nothing" or if there was others tools that could do the job better.


i think ray-casting is what you are after. one of the ogre tutorials on the wiki shows how to do this. this is used if you just want to detect collision with terrain, or other things.

im not too sure about the debug lines problem though. ive only ever used the built-in newton listener. but im not too sure it could be a bug though if the ogrenewt::basicframelistener implementes it successfully :wink:

Narf

03-12-2006 12:36:21

The problem of raycasting is that the bounding boxes of object are not accurate enought in Ogre. That's why i moved to a physic engine.

And the crash occurs even with basicFrameListener in debug mode. I tried to make the simplest apli i could, with nothing in the scene and it crashs when i press F3.

unclepauly

04-12-2006 12:07:59

in that case im out of ideas, sorry :?

i think raycasting and OgreNewt collision objetcs are the only methods to detect collision - maybe someone can confirm?

im just so busy with uni stuff that i havent even got time to check out the debug lines problem. i would say the obvious answer is to inspect the ogrenewt .h file that has the debug lines code, but i am guessing you have already done this...

sorry i cant be of any help here...