IrrODE - an Irrlicht - ODE wrapper (now with SVN)

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

Post by buhatkj »

hey ulao, Maybe I can help a little too.

for one thing there is no irrODE.dll because irrODE builds as a static .lib file, it has no DLL. you do need a ode_single.dll built with whatever compiler you are using....

The irrlicht.dll and ode_single.dll brainsaw included are bigger than ones built by vs2008 because they were built with gcc in code::blocks, which makes bigger DLL files since it's not as optimized for windows.

as for your compiler errors, yeh you need to download ode 0.11 and set up the project include paths in vs2008 to include it's headers as well to fix your errors.

the vs2008 project for the irredit plugin does not need to link against the irrODE.lib or ODE itself i think because it uses #ifdef _IRREDIT_PLUGIN and _USE_ODE_NULL_DEVICE to prevent doing any actual physics work when it is compiled in that project. Therefore it is just making sort of empty classes that have the same members, but don't actually implement any ODE functionality.

hth!
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

buhatkj, thx so much, this is what was confusing me..

Brainsaw -
The program should definetely not start without the DLL, I did not compile ODE into the wrapper.
I guess he meant a different dll, No wonder I was so confused.

So I know my troubles are with the ode_single dll...

I think I got it from here.

thx buhatkj.

UPDATE, it works ;)
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

@buhatkj: I don't know if I can find the time to do the fix ... do you know of a way to get the size of the heightmap image? That would be the fix, but I couldn't find such functionality yet. I don't want to add any function you have to call to do that, because that would screw up the plugin (I think), and one important thing (for me) is to just register the factory in order to have an IrrOdEdit scene loaded and running. Maybe (heightmaps have to be square, don't they?) I could use the square root of the vertex cound? I am not that deep in terrain rendering, the only terrain I ever used is the one from the demos. Or you just send me a big terrain and I'll try to get it running with one of the demo apps.

@ulao: I see this was the main problem I see with forums on the net: you never know exactly what the other person is talking about ;) . Nice to hear you got it running.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

Post by buhatkj »

yeh I can try to look into it brainsaw, since i would like to use terrain in my app ;-)
if i get it figured out i'll send you a diff.
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

buhatkj, I just read your posts and totally had a flash back..

I was working with the physX wrapper and had this same problem, you can read if you like its here

http://irrlicht.sourceforge.net/phpBB2/ ... &start=270

I think its the y in the irrlicht code that causes this. I too will be using a terrain very soon, so I will let you know my findings.


BrainSaw, how do I get debug to work?

I tried to add this to the irr Example.

Code: Select all

  CIrrOdeWorld * world = (CIrrOdeWorld*) smgr->getSceneNodeFromName("world") ;
Then I tried world->render(); in a few spots, with no luck.

I made sure to name my word entity in the irr file.
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

I don't know if (or how) you can render a scenenode directly ... maybe it would just render that node, not the tree. Why don't you just use the standard way (beginScene, drawAll, endScene)?

If you want to use the debug version you'd have to compile everything in debug mode. The dlls (ode_single, irrlicht) are both release versions, so you can't debug into them. If you just compile your project in debug mode you can step into you project files and IrrODE (if you have a debug lib ... you have created a lib, right?).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

Ah, I think I miss understood things, I want to show wire frames. I call this debug. I thought I read somewhere that render would do that.
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

got my terrain working....

Post by buhatkj »

Hey guys I think I mostly got the problem with heightfields figured. Basically I did 2 things, I calculate the actual number of width and depth samples as brainsaw had suggested, the square root of the vertex count. And I removed this little thinger that had been shifting the geom body by 1/2 of the width and depth.
I think this mostly does the trick....

Code: Select all

void CIrrOdeGeomHeightfield::initPhysics() {
  if (m_bPhysicsInitialized) return;

  updateAbsolutePosition();
  m_pBoundingBox->reset(getAbsolutePosition());
  m_pSpace=reinterpret_cast<CIrrOdeSpace *>(getAncestorOfType((ESCENE_NODE_TYPE)IRR_ODE_SPACE_ID));
  if (!m_pSpace) m_pSpace=m_pWorld->getSpace();

  ITerrainSceneNode *pParentNode=reinterpret_cast<ITerrainSceneNode *>(getParent());

  m_fWidth=pParentNode->getBoundingBox().MaxEdge.X-pParentNode->getBoundingBox().MinEdge.X;
  m_fDepth=pParentNode->getBoundingBox().MaxEdge.Z-pParentNode->getBoundingBox().MinEdge.Z;

  //try to automagically calculate the width and depth of the heightmap from the vertex count
  CDynamicMeshBuffer tmpMB(video::EVT_2TCOORDS, video::EIT_16BIT);
  pParentNode->getMeshBufferForLOD(tmpMB);
  u32 vc = tmpMB.getVertexCount();
  m_iWidthSamples = m_iDepthSamples = ((u32)sqrt((double)vc));
  printf("Terrain heightfield samples:%d \n", m_iDepthSamples);

  m_iDataId=m_pOdeDevice->geomHeightfieldDataCreate();
  m_pOdeDevice->geomHeightfieldDataCallback(m_iDataId,this,(void *)(CIrrOdeGeomHeightfield::getHeightCallback),m_fWidth,m_fDepth,m_iWidthSamples,m_iDepthSamples,1.0f,0.0f,m_fThickness,0);
  m_pOdeDevice->geomHeightfieldSetBounds(m_iDataId,-1000.0f,1000.0f);
  m_iGeomId=m_pOdeDevice->geomCreateHeightfield(m_pSpace->getSpaceId(),m_iDataId);
  vector3df pos=pParentNode->getAbsolutePosition();

  //pos.X+=m_fWidth/2;
  //pos.Z+=m_fDepth/2;

  m_pOdeDevice->geomSetPosition(m_iGeomId,pos);
  m_pOdeDevice->geomSetBody(this,NULL);
  m_pOdeDevice->geomSetData(m_iGeomId,this);
  #ifdef _TRACE_INIT_PHYSICS
    printf("CIrrOdeGeomHeightfield::initPhysics: terrain size: (%.2f, %.2f)\n",m_fWidth,m_fDepth);
    printf("CIrrOdeGeomHeightfield::initPhysics: terrain position: (%.2f, %.2f, %.2f)\n",pos.X,pos.Y,pos.Z);
  #endif

  CIrrOdeGeom::initPhysics();
  m_bPhysicsInitialized=true;
}
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Hello and thanks for the patch buhatkj. Integrated it and uploaded a new version. This new version does now also contain a helicopter in IrrOdeCar (I know ... the name should be changed ;) ). I had to uncomment the shifting of the ODE heightfield, because ODE assumes the heightfield's position at the center of the terrain whereas Irrlicht uses one of the corners. Are you using the heightfield that comes with Irrlicht, or some additional one. In that case IrrODE might have to treat the different scene node types differentely. Or is this a change in ODE 0.11.1 thank has been released recently? Haven't tried that new ODE version yet.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

thank you

Post by netpipe »

great work Brainsaw i've been checking this thread alot for updates and this one is a gooder.

anyhow here's the Linux friendly CB projects also i had to rename IrrODE.h to IrrOde.h in the includes folder to keep all your code case sensitive. please put this in the next release :)

http://www.xup.in/dl,57433293/irrOde.7z
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

hey BrainSaw, hoped that you could shed some light my way on this error?

I'm trying my own irr files with your plugin and I get an Access violation this error when I attempt to load the scene

The stack pointer has stopped here.

Code: Select all


void CIrrOdeGeomBox::initPhysics() {
  if (m_bPhysicsInitialized) return;

  getParent()->updateAbsolutePosition();
  updateAbsolutePosition();
  m_pSpace=reinterpret_cast<CIrrOdeSpace *>(getAncestorOfType((ESCENE_NODE_TYPE)IRR_ODE_SPACE_ID));
  if (!m_pSpace) m_pSpace=m_pWorld->getSpace();

  if (m_fWidth==0.0f && m_fHeight==0.0f && m_fDepth==0.0f) {
    IAnimatedMeshSceneNode *pParent=reinterpret_cast<IAnimatedMeshSceneNode *>(getParent());
=-->    IMesh *pMesh=pParent->getMesh()->getMesh(0);
If I remove the geomBox I dont get the crash, but of course it wont do anything ;)
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

Post by buhatkj »

heya brainsaw,
nope just using ODE 0.11 i'm pretty sure. I am using a different heightfield though, and I have arranged stuff in irredit, so that my heightfield is roughly centered on 0,0,0.
now that you say though, that is clearly the issue, that the ODE heightfield must always be offset by 1/2 the width to the irrlicht one. probably we need to look at the logic in getHeightCallback and adjust that with this in mind!
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

@ulao: the CIrrOdeGeomBox scene node must be the child of an animated mesh scene node. I think I should add some additional checks there, but the program would run and nothing would happen. Have you taken a look at my second tutorial (http://www.bulletbyte.de/irrOde/tutoria ... ial02.html)? IrrOde does currently only support AnimatedMeshSceneNodes, so if you use another type of scene node it won't work. Maybe you could upload your .irr file to some place and post a link here so I can take a look at it.

@buhatkj: I think the offset is working the way it should (removed it --> car in IrrOdeCar falls through the terrain, put it back in --> car drives over the hills), but I got another idea. Since I use the ODE backcall method I think I could tell ODE that the heightfield has more samples than it really has, the Irrlicht getHeight method will provide the correct data. I think the problem that I see often (the objects sinking into the terrain) could at least be reduced this way (maybe ODE interpolates the triangles of the heightfield in a different way than Irrlicht does, e.g. if we have the indices 1, 2, 3, 4 in a square Irrlicht takes the triangles as (1,2,3) and (1,3,4) whereas ODE assumes (1,2,4) and (2,4,3). Just a theory, I'll have to check that out when I'm back home.

@tecan: welcome to the thread and thanks for the C::B project. I'll update the project when I'm back home and upload it.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

@tecan: I just did another upload:

- included your modifications to the code::blocks project ... thanks a lot for that
- renamed irrODE.h to irrOde.h, should now compile under Linux "out of the box" (I hope ... don't have Linux installed)
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
ulao
Posts: 274
Joined: Fri Mar 28, 2008 2:13 am

Post by ulao »

the CIrrOdeGeomBox scene node must be the child of an animated mesh scene node. I think I should add some additional checks there, but the program would run and nothing would happen. Have you taken a look at my second tutorial (http://www.bulletbyte.de/irrOde/tutoria ... ial02.html)? IrrOde does currently only support AnimatedMeshSceneNodes, so if you use another type of scene node it won't work. Maybe you could upload your .irr file to some place and post a link here so I can take a look at it.
Yes I used the tut. but I had a non animated mesh in there. Removing it did pass that error. I was able to get my ball to drop, but I ran in to another error with a very complicated mesh.

I get a popup box titled "ode internal error 2" with erro "Bad argument(s) (..\..\ode\capsulecpp:51) . " Capsules are support in th plugin right?

however If I make it a geomBox it works.

Also had a few questions.

can I not use terrains meshes? If not when might that be available if ever in the plugin.

I pretty sure this is a bit premature. But is there a way to make objects collidable in the editor?

Do I need to call loadScene before the ode init?



thx for the reply :)
Post Reply